public void ShowNode_EmptyFilterSet_AlwaysReturnsTrue() { FilterCombinator<Boolean> combinator = new FilterCombinator<Boolean>(); Assert.AreEqual(0, combinator.Filters.Count, "Initial Filters count"); Assert.IsTrue(combinator.ShowNode(true), "Empty combinator should return true for ShowNode(true)."); Assert.IsTrue(combinator.ShowNode(false), "Empty combinator should return true for ShowNode(false)."); }
public void ShowNode_AndPredicate_ANDsFilterResults() { FilterCombinator<Boolean> combinator = new FilterCombinator<Boolean>(); combinator.Predicate = Functor.And; Mock<Filter<Boolean>> filterA = new Mock<Filter<Boolean>>(); filterA.Setup(f => f.ShowNode(It.IsAny<Boolean>())).Returns(true); combinator.Filters.Add(filterA.Object); Mock<Filter<Boolean>> filterB = new Mock<Filter<Boolean>>(); filterB.Setup(f => f.ShowNode(It.IsAny<Boolean>())).Returns(false); combinator.Filters.Add(filterB.Object); Assert.IsFalse(combinator.ShowNode(true)); Assert.IsFalse(combinator.ShowNode(false)); filterA.Verify(f => f.ShowNode(It.IsAny<Boolean>()), Times.AtLeastOnce); filterB.Verify(f => f.ShowNode(It.IsAny<Boolean>()), Times.AtLeastOnce); }