public void GetDifferences_AllValuesEqual_ReturnsEmpty() { var baseline = new FakeTestItem { TestInt = 20, TestString = "TestString" }; var comparison = new FakeTestItem { TestInt = 20, TestString = "TestString" }; var propertiesToCompare = Array.Empty<string>(); IEnumerable<PropertyComparisonResult> expected = new List<PropertyComparisonResult>(); var actual = baseline.GetDifferences(comparison, propertiesToCompare); CollectionAssert.AreEqual(expected.ToList(), actual.ToList()); }
public void GetDifferences_AllValuesDifferent_MatchesExpected() { var baseline = new FakeTestItem { TestInt = 20, TestString = "TestString" }; var comparison = new FakeTestItem { TestInt = 21, TestString = "TestString2" }; var propertiesToCompare = Array.Empty<string>(); var expected = new List<PropertyComparisonResult> { new PropertyComparisonResult("TestInt", 20, 21), new PropertyComparisonResult("TestString", "TestString", "TestString2") }; var actual = baseline.GetDifferences(comparison, propertiesToCompare).ToList(); CollectionAssert.AreEqual(expected, actual); }
public void GetDifferences_AllValuesDifferentWithSpecifiedProperties_MatchesExpected() { var baseline = new FakeTestItem { TestDateTime = DateTime.MinValue, TestInt = 20, TestString = "TestString" }; var comparison = new FakeTestItem { TestDateTime = DateTime.MaxValue, TestInt = 21, TestString = "TestString2" }; var propertiesToCompare = new[] { "TestInt", "TestString" }; IEnumerable<PropertyComparisonResult> expected = new List<PropertyComparisonResult> { new PropertyComparisonResult("TestInt", 20, 21), new PropertyComparisonResult("TestString", "TestString", "TestString2") }; IEnumerable<PropertyComparisonResult> actual = baseline.GetDifferences(comparison, propertiesToCompare); CollectionAssert.AreEqual(expected.ToList(), actual.ToList()); }