コード例 #1
0
        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);
        }
コード例 #2
0
        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);
        }
コード例 #3
0
        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);
        }
コード例 #4
0
        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);
        }