public void TestFilterNotCondition() { TestCaseFilter filter = new TestCaseFilter(); RuleGroup group1 = new RuleGroup() { Name = "Group1", Description = "This is the first group.", RuleGroupType = RuleType.Selector }; Rule rule11 = new Rule() { Name = "Rule11", SelectStatus = RuleSelectStatus.Selected, CategoryList = new System.Collections.Generic.List <string>() { "Cat1", "Cat2", "Cat3" } }; Rule rule12 = new Rule() { Name = "Rule12", SelectStatus = RuleSelectStatus.Selected, CategoryList = new System.Collections.Generic.List <string>() { "Cat4", "Cat5", "Cat6" } }; group1.Add(rule11); group1.Add(rule12); RuleGroup group2 = new RuleGroup() { Name = "Group2", Description = "This is the second group.", RuleGroupType = RuleType.Selector }; Rule rule2 = new Rule() { Name = "Rule2", SelectStatus = RuleSelectStatus.Selected, CategoryList = new System.Collections.Generic.List <string>() { "!Cat1", "!Cat2", "Cat3" } }; group2.Add(rule2); filter.Add(group1); filter.Add(group2); string filterExp = filter.GetFilterExpression(); Assert.AreEqual( "(TestCategory=Cat4|TestCategory=Cat5|TestCategory=Cat6|TestCategory=Cat1|TestCategory=Cat2|TestCategory=Cat3)&(TestCategory!=Cat1|TestCategory!=Cat2|TestCategory=Cat3)", filterExp, "Verify filter expression with NOT condition."); }
public void TestFilterExpression() { TestCaseFilter filter = CreateSampleTestFilter(); string filterExp = filter.GetFilterExpression(); Assert.AreEqual( "(TestCategory=Cat1|TestCategory=Cat2|TestCategory=Cat3)&(TestCategory!=Cat7&TestCategory!=Cat8)", filterExp, "Verify filter expression"); }
public void TestFilterNotCondition() { TestCaseFilter filter = new TestCaseFilter(); RuleGroup group1 = new RuleGroup() { Name = "Group1", Description = "This is the first group.", RuleGroupType = RuleType.Selector }; Rule rule11 = new Rule() { Name = "Rule11", SelectStatus = RuleSelectStatus.Selected, CategoryList = new System.Collections.Generic.List<string>() { "Cat1", "Cat2", "Cat3" } }; Rule rule12 = new Rule() { Name = "Rule12", SelectStatus = RuleSelectStatus.Selected, CategoryList = new System.Collections.Generic.List<string>() { "Cat4", "Cat5", "Cat6" } }; group1.Add(rule11); group1.Add(rule12); RuleGroup group2 = new RuleGroup() { Name = "Group2", Description = "This is the second group.", RuleGroupType = RuleType.Selector }; Rule rule2 = new Rule() { Name = "Rule2", SelectStatus = RuleSelectStatus.Selected, CategoryList = new System.Collections.Generic.List<string>() { "!Cat1", "!Cat2", "Cat3" } }; group2.Add(rule2); filter.Add(group1); filter.Add(group2); string filterExp = filter.GetFilterExpression(); Assert.AreEqual( "(TestCategory=Cat4|TestCategory=Cat5|TestCategory=Cat6|TestCategory=Cat1|TestCategory=Cat2|TestCategory=Cat3)&(TestCategory!=Cat1|TestCategory!=Cat2|TestCategory=Cat3)", filterExp, "Verify filter expression with NOT condition."); }