public void ChangedHighAndLowLevelOrderWithTinyValueChangeExpectingNotEqualTest() { // Arrange var reference = TestObjectHierarchyFactory.CreateHoldingsReport(2); var difference = TestObjectHierarchyFactory.CreateHoldingsReport(2); var rand = new Random(); difference.Holdings = difference.Holdings.OrderBy(x => rand.Next()).ToList(); difference.Holdings.ForEach(h => { h.Identifiers = h.Identifiers.OrderBy(y => rand.Next()).ToList(); h.Attributes = h.Attributes.OrderBy(y => rand.Next()).ToList(); }); var mutantSubject = difference.Holdings.OfType <Bond>().First(); var expectedMaturity = mutantSubject.Maturity; mutantSubject.Maturity = DateTime.Today.AddDays(1); // Act var actual = sut.Compare(reference, difference); // Assert Assert.That(actual, Is.Not.Null); Assert.That(actual.AreEqual, Is.False); Assert.That(actual.Differences, Is.Not.Null); Assert.That(actual.Differences.Count, Is.EqualTo(1)); var first = actual.Differences.First(); Assert.That(first, Is.Not.Null); Assert.That(first.Object1Value, Is.EqualTo(expectedMaturity.ToString())); Assert.That(first.Object2Value, Is.EqualTo(mutantSubject.Maturity.ToString())); }
public void ChangedHighLevelOrderExpectingEqualTest() { // Arrange var reference = TestObjectHierarchyFactory.CreateHoldingsReport(2); var difference = TestObjectHierarchyFactory.CreateHoldingsReport(2); var rand = new Random(); difference.Holdings = difference.Holdings.OrderBy(x => rand.Next()).ToList(); // Act var actual = sut.Compare(reference, difference); // Assert Assert.That(actual, Is.Not.Null); Assert.That(actual.AreEqual, Is.True); Assert.That(actual.Differences, Is.Not.Null); Assert.That(actual.Differences.Count, Is.EqualTo(0)); }
public void SameOrderExpectingEqualTest() { // Arrange var reference = TestObjectHierarchyFactory.CreateHoldingsReport(2); var difference = TestObjectHierarchyFactory.CreateHoldingsReport(2); // Act var actual = sut.Compare(reference, difference); // Assert Assert.That(actual, Is.Not.Null); Assert.That(actual.Differences, Is.Not.Null); actual.Differences.ForEach(x => { Console.WriteLine($"Path: {x.PropertyName}"); Console.WriteLine($" Expected: {x.Object1Value}"); Console.WriteLine($" Received: {x.Object2Value}"); }); Assert.That(actual.AreEqual, Is.True); Assert.That(actual.Differences.Count, Is.EqualTo(0)); }
public void ChangedHighAndLowLevelOrderWithKeyChangeExpectingNotEqualTest() { // Arrange var reference = TestObjectHierarchyFactory.CreateHoldingsReport(2); var difference = TestObjectHierarchyFactory.CreateHoldingsReport(2); var rand = new Random(); difference.Holdings = difference.Holdings.OrderBy(x => rand.Next()).ToList(); difference.Holdings.ForEach(h => { h.Identifiers = h.Identifiers.OrderBy(y => rand.Next()).ToList(); h.Attributes = h.Attributes.OrderBy(y => rand.Next()).ToList(); }); var mutantSubject = difference.Holdings.OfType <Bond>().First(); var expectedDescription = mutantSubject.Description; mutantSubject.Description = "Mutated value"; // Act var actual = sut.Compare(reference, difference); // Assert Assert.That(actual, Is.Not.Null); Assert.That(actual.AreEqual, Is.False); Assert.That(actual.Differences, Is.Not.Null); Assert.That(actual.Differences.Count, Is.EqualTo(2)); var first = actual.Differences.First(); Assert.That(first, Is.Not.Null); Assert.That(first.Object2, Is.Null); var last = actual.Differences.Last(); Assert.That(last, Is.Not.Null); Assert.That(last.Object1, Is.Null); }