コード例 #1
0
        public void Test_IsMatch_2SubGroups_False()
        {
            TestArticle article = new TestArticle();
            article.ID = Guid.NewGuid();
            article.Title = "Article1";

            // Outer group
            FilterGroup group = new FilterGroup();
            group.Operator = FilterGroupOperator.And; // BOTH child groups MUST match

            FilterGroup subGroup1 = new MockFailingFilterGroup();
            FilterGroup subGroup2 = new MockMatchingFilterGroup();

            group.Add(subGroup1);
            group.Add(subGroup2);

            Assert.IsFalse(subGroup1.IsMatch(article), "First sub group matches when it shouldn't.");
            Assert.IsTrue(subGroup2.IsMatch(article), "Second sub group doesn't match when it should.");

            Assert.IsFalse(group.IsMatch(article), "Entire group matched when it shouldn't match");
        }
コード例 #2
0
        public void Test_IsMatch_2SubGroups_False()
        {
            TestArticle article = new TestArticle();

            article.ID    = Guid.NewGuid();
            article.Title = "Article1";

            // Outer group
            FilterGroup group = new FilterGroup();

            group.Operator = FilterGroupOperator.And;             // BOTH child groups MUST match

            FilterGroup subGroup1 = new MockFailingFilterGroup();
            FilterGroup subGroup2 = new MockMatchingFilterGroup();

            group.Add(subGroup1);
            group.Add(subGroup2);

            Assert.IsFalse(subGroup1.IsMatch(article), "First sub group matches when it shouldn't.");
            Assert.IsTrue(subGroup2.IsMatch(article), "Second sub group doesn't match when it should.");

            Assert.IsFalse(group.IsMatch(article), "Entire group matched when it shouldn't match");
        }