public void FilterShouldReturnNullIfNoMatchingChildDiffs() { var difference = new Difference("prop", 1, 2) { ChildDiffs = new List<Difference> { new Difference("a", 1337, 0), } }; var filtered = difference.Filter(d => false); Assert.IsNull(filtered); }
public void FilterShouldReturnNullIfNoMatchingChildDiffs() { var difference = new Difference("prop", 1, 2) { ChildDiffs = new List <Difference> { new Difference("a", 1337, 0), } }; var filtered = difference.Filter(d => false); Assert.IsNull(filtered); }
public void FilterShouldRemoveNonMatchingChildDiffs() { var difference = new Difference("prop", 1, 2) { ChildDiffs = new List<Difference> { new Difference("a", 1337, 0), new Difference("b", 123, 456) } }; var filtered = difference.Filter(d => d.PropertyName != "a"); Assert.AreEqual(1, filtered.ChildDiffs.Count()); var childDiff = filtered.ChildDiffs.First(); Assert.AreEqual("b", childDiff.PropertyName); Assert.AreEqual(123, childDiff.NewValue); Assert.AreEqual(456, childDiff.OldValue); Assert.IsNull(childDiff.ChildDiffs); }
public void FilterShouldRemoveNonMatchingChildDiffs() { var difference = new Difference("prop", 1, 2) { ChildDiffs = new List <Difference> { new Difference("a", 1337, 0), new Difference("b", 123, 456) } }; var filtered = difference.Filter(d => d.PropertyName != "a"); Assert.AreEqual(1, filtered.ChildDiffs.Count()); var childDiff = filtered.ChildDiffs.First(); Assert.AreEqual("b", childDiff.PropertyName); Assert.AreEqual(123, childDiff.NewValue); Assert.AreEqual(456, childDiff.OldValue); Assert.IsNull(childDiff.ChildDiffs); }