public void ShouldNotMatchWithNoContainedRules() { MatchingRuleSet ruleSet = new MatchingRuleSet(); MethodBase member = GetType().GetMethod("ShouldNotMatchWithNoContainedRules"); Assert.IsFalse(ruleSet.Matches(member)); }
public void ShouldMatchWithMatchingTypeRule() { MatchingRuleSet ruleSet = new MatchingRuleSet(); ruleSet.Add(new TypeMatchingRule(typeof(MatchingRuleSetFixture))); MethodBase member = GetType().GetMethod("ShouldMatchWithMatchingTypeRule"); Assert.IsTrue(ruleSet.Matches(member)); }
public void ShouldMatchTypeWithTypeMatchRule() { MatchingRuleSet ruleSet = new MatchingRuleSet(); ruleSet.Add(new TypeMatchingAssignmentRule(typeof(MockDal))); Assert.IsTrue(ruleSet.Matches(typeof(MockDal))); }
public void ShouldNotMatchTypeWithNoRules() { MatchingRuleSet ruleSet = new MatchingRuleSet(); Assert.IsFalse(ruleSet.Matches(typeof(MockDal))); Assert.IsFalse(ruleSet.Matches(typeof(string))); }
/// <summary> /// Creates a new <see cref="RuleDrivenPolicy"/> object with a name, a set of matching rules /// and the names to use when resolving handlers. /// </summary> public RuleDrivenPolicy(string name, IMatchingRule[] matchingRules, string[] callHandlerNames) : base(name) { this.ruleSet = new MatchingRuleSet(); this.ruleSet.AddRange(matchingRules); this.callHandlerNames = callHandlerNames; }
/// <summary> /// Creates a new <see cref="RuleDrivenPolicy"/> object with a name, a set of matching rules /// and the names to use when resolving handlers. /// </summary> public RuleDrivenPolicy(string name, IMatchingRule[] matchingRules, string[] callHandlerNames) : base(name) { _ruleSet = new MatchingRuleSet(); _ruleSet.AddRange(matchingRules); _callHandlerNames = callHandlerNames; }
public void ShouldNotMatchWhenOneRuleDoesntMatch() { MethodBase member = GetType().GetMethod("ShouldNotMatchWhenOneRuleDoesntMatch"); MatchingRuleSet ruleSet = new MatchingRuleSet(); ruleSet.Add(new TypeMatchingRule(typeof(MatchingRuleSetFixture))); Assert.IsTrue(ruleSet.Matches(member)); ruleSet.Add(new MemberNameMatchingRule("ThisMethodDoesntExist")); Assert.IsFalse(ruleSet.Matches(member)); }