public void ShouldMatchWithMultipleMatchOptions() { IMatchingRule rule = new NamespaceMatchingRule(new MatchingInfo[] { new MatchingInfo(TopLevelNamespace), new MatchingInfo(ThirdLevelNamespace), new MatchingInfo(TopLevelTwoNamespace.ToUpperInvariant(), true) }); Assert.IsTrue(rule.Matches(GetTargetMethod(typeof(TopLevelTarget)))); Assert.IsFalse(rule.Matches(GetTargetMethod(typeof(SecondLevelTarget)))); Assert.IsTrue(rule.Matches(GetTargetMethod(typeof(ThirdLevelTarget)))); Assert.IsFalse(rule.Matches(GetTargetMethod(typeof(SeparateTarget)))); Assert.IsTrue(rule.Matches(GetTargetMethod(typeof(TopLevelTwoTarget)))); }
private void TestMatch(string namespaceName, bool ignoreCase, Type targetType, bool shouldMatch) { NamespaceMatchingRule rule = new NamespaceMatchingRule(namespaceName, ignoreCase); MethodInfo methodToMatch = targetType.GetMethod("TargetMethod"); Assert.AreEqual(shouldMatch, rule.Matches(methodToMatch)); }
void TestMatch(string namespaceName, bool ignoreCase, Type targetType, bool shouldMatch) { NamespaceMatchingRule rule = new NamespaceMatchingRule(namespaceName, ignoreCase); MethodInfo methodToMatch = targetType.GetMethod("TargetMethod"); Assert.AreEqual(shouldMatch, rule.Matches(methodToMatch)); }