Skip to content

Commit

Permalink
Fixes #3, tests that failed because they were dependent on the machin…
Browse files Browse the repository at this point in the history
…e's locale.
  • Loading branch information
Starkie committed Jul 2, 2018
1 parent 45fd658 commit 2ef757c
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 38 deletions.
37 changes: 3 additions & 34 deletions test/EntityChange.Tests/EntityCompareTests.cs
@@ -1,6 +1,7 @@
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Globalization;
using System.Linq;
using EntityChange.Tests.Models;
using FluentAssertions;
Expand All @@ -16,6 +17,7 @@ public class EntityCompareTests
public EntityCompareTests(ITestOutputHelper output)
{
_output = output;
CultureInfo.DefaultThreadCurrentCulture = new CultureInfo("en-US");
}

[Fact]
Expand Down Expand Up @@ -61,7 +63,6 @@ public void CompareObjectTest()
changes[2].Path.Should().Be("Total");

WriteMarkdown(changes);

}

[Fact]
Expand Down Expand Up @@ -100,7 +101,6 @@ public void CompareObjectValueFormatter()
changes[0].CurrentFormatted.Should().Be("$11,000.00");

WriteMarkdown(changes);

}

[Fact]
Expand Down Expand Up @@ -148,7 +148,6 @@ public void CompareObjectNewPropertyTest()
changes[3].Path.Should().Be("Total");

WriteMarkdown(changes);

}

[Fact]
Expand Down Expand Up @@ -197,7 +196,6 @@ public void CompareObjectRemovePropertyTest()
changes[3].Path.Should().Be("Total");

WriteMarkdown(changes);

}

[Fact]
Expand Down Expand Up @@ -237,7 +235,6 @@ public void CompareObjectNewObjectTest()
changes[2].Path.Should().Be("Total");

WriteMarkdown(changes);

}

[Fact]
Expand Down Expand Up @@ -277,10 +274,8 @@ public void CompareObjectRemoveObjectTest()
changes[2].Path.Should().Be("Total");

WriteMarkdown(changes);

}


[Fact]
public void CompareCollectionAddItemTest()
{
Expand Down Expand Up @@ -321,7 +316,6 @@ public void CompareCollectionAddItemTest()
changes[3].Path.Should().Be("Total");

WriteMarkdown(changes);

}

[Fact]
Expand Down Expand Up @@ -364,7 +358,6 @@ public void CompareCollectionRemoveItemTest()
changes[3].Path.Should().Be("Total");

WriteMarkdown(changes);

}

[Fact]
Expand Down Expand Up @@ -415,7 +408,6 @@ public void CompareCollectionReplaceTest()
changes[2].Path.Should().Be("Total");

WriteMarkdown(changes);

}

[Fact]
Expand Down Expand Up @@ -466,7 +458,6 @@ public void CompareCollectionRemoveTest()
changes[2].Path.Should().Be("Total");

WriteMarkdown(changes);

}

[Fact]
Expand Down Expand Up @@ -498,7 +489,6 @@ public void CompareCollectionReplaceEmptyTest()
changes[1].Path.Should().Be("Total");

WriteMarkdown(changes);

}

[Fact]
Expand Down Expand Up @@ -530,7 +520,6 @@ public void CompareCollectionRemoveEmptyTest()
changes[1].Path.Should().Be("Total");

WriteMarkdown(changes);

}

[Fact]
Expand Down Expand Up @@ -577,7 +566,6 @@ public void CompareCollectionObjectEqualityTest()
);
var comparer = new EntityComparer(configuration);


var changes = comparer.Compare(original, current);

changes.Should().NotBeNull();
Expand All @@ -589,10 +577,8 @@ public void CompareCollectionObjectEqualityTest()
changes[3].Path.Should().Be("Items[1].UnitPrice");

WriteMarkdown(changes);

}


[Fact]
public void CompareDictionaryTest()
{
Expand All @@ -606,7 +592,6 @@ public void CompareDictionaryTest()
}
};


var current = new Contact
{
Id = original.Id,
Expand All @@ -630,7 +615,6 @@ public void CompareDictionaryTest()
changes[1].Operation.Should().Be(ChangeOperation.Replace);

WriteMarkdown(changes);

}

[Fact]
Expand Down Expand Up @@ -666,7 +650,6 @@ public void CompareDictionaryAddItemTest()
changes[0].Operation.Should().Be(ChangeOperation.Add);

WriteMarkdown(changes);

}

[Fact]
Expand Down Expand Up @@ -702,7 +685,6 @@ public void CompareDictionaryRemoveItemTest()
changes[0].Operation.Should().Be(ChangeOperation.Remove);

WriteMarkdown(changes);

}

[Fact]
Expand Down Expand Up @@ -733,7 +715,6 @@ public void CompareDictionaryReplaceTest()
changes[0].Operation.Should().Be(ChangeOperation.Add);

WriteMarkdown(changes);

}

[Fact]
Expand Down Expand Up @@ -764,7 +745,6 @@ public void CompareDictionaryRemoveTest()
changes[0].Operation.Should().Be(ChangeOperation.Remove);

WriteMarkdown(changes);

}

[Fact]
Expand Down Expand Up @@ -815,7 +795,6 @@ public void CompareDictionaryRemoveEmptyTest()
WriteMarkdown(changes);
}


[Fact]
public void CompareSetAddItemTest()
{
Expand All @@ -825,7 +804,6 @@ public void CompareSetAddItemTest()
Categories = new HashSet<string> { "Person", "Owner" },
};


var current = new Contact
{
Id = original.Id,
Expand Down Expand Up @@ -854,7 +832,6 @@ public void CompareSetRemoveItemTest()
Categories = new HashSet<string> { "Person", "Owner", "Blah" },
};


var current = new Contact
{
Id = original.Id,
Expand All @@ -874,7 +851,6 @@ public void CompareSetRemoveItemTest()
WriteMarkdown(changes);
}


[Fact]
public void CompareComplexCompareTest()
{
Expand Down Expand Up @@ -915,7 +891,6 @@ public void CompareComplexCompareTest()
}
};


var current = new Contact
{
Id = original.Id,
Expand Down Expand Up @@ -980,7 +955,6 @@ public void CompareComplexCompareTest()
changes.Should().NotBeNull();
changes.Count.Should().Be(10);


WriteMarkdown(changes);
}

Expand Down Expand Up @@ -1032,8 +1006,6 @@ public void ComparenNestedObjectsPathsTest()
changes.First().Path.Should().Be("nodes[0].nodes[0].Name");
}



private void WriteMarkdown(ReadOnlyCollection<ChangeRecord> changes)
{
var formatter = new MarkdownFormatter();
Expand All @@ -1042,7 +1014,4 @@ private void WriteMarkdown(ReadOnlyCollection<ChangeRecord> changes)
_output.WriteLine(markdown);
}
}



}
}
11 changes: 7 additions & 4 deletions test/EntityChange.Tests/StringFomatterTests.cs
@@ -1,5 +1,6 @@
using System;
using System.Collections.Generic;
using System.Globalization;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
Expand All @@ -11,6 +12,11 @@ namespace EntityChange.Tests
{
public class StringFomatterTests
{
public StringFomatterTests()
{
CultureInfo.DefaultThreadCurrentCulture = new CultureInfo("en-US");
}

[Fact]
public void NumberFormat()
{
Expand Down Expand Up @@ -41,7 +47,4 @@ public void CurrencyFormat()
formatted.Should().Be("$100,042.00");
}
}



}
}

0 comments on commit 2ef757c

Please sign in to comment.