public void CanMatchOnParameterlessMethods() { List <string> parameterLess = new List <string>(); MethodSignatureMatchingRule matchingRule = new MethodSignatureMatchingRule(parameterLess); Assert.IsTrue(matchingRule.Matches(objectToStringMethod)); }
public void MatchIsDeniedWhenParamterValuesCountDiffers() { List<string> oneParam = new List<string>(); oneParam.Add("one"); MethodSignatureMatchingRule matchingRule = new MethodSignatureMatchingRule(oneParam); Assert.IsFalse(matchingRule.Matches(objectToStringMethod)); }
public void MatchIsDeniedWhenParamterValuesCountDiffers() { List <string> oneParam = new List <string>(); oneParam.Add("one"); MethodSignatureMatchingRule matchingRule = new MethodSignatureMatchingRule(oneParam); Assert.IsFalse(matchingRule.Matches(objectToStringMethod)); }
public void MatchIsDeniedWhenASingleParameterIsWrong() { List<string> parametersForCopyToMethod = new List<string>(); parametersForCopyToMethod.Add("System.Int32"); parametersForCopyToMethod.Add("System.Char[]"); parametersForCopyToMethod.Add("System.NotAnInt32"); parametersForCopyToMethod.Add("System.Int32"); MethodSignatureMatchingRule matchingRule = new MethodSignatureMatchingRule(parametersForCopyToMethod); Assert.IsFalse(matchingRule.Matches(stringCopyToMethod)); }
public void CanMatchOnMultipleParameterTypes() { List<string> parametersForCopyToMethod = new List<string>(); parametersForCopyToMethod.Add("System.Int32"); parametersForCopyToMethod.Add("System.Char[]"); parametersForCopyToMethod.Add("System.Int32"); parametersForCopyToMethod.Add("System.Int32"); MethodSignatureMatchingRule matchingRule = new MethodSignatureMatchingRule(parametersForCopyToMethod); Assert.IsTrue(matchingRule.Matches(stringCopyToMethod)); }
public void MatchIsDeniedWhenASingleParameterIsWrong() { List <string> parametersForCopyToMethod = new List <string>(); parametersForCopyToMethod.Add("System.Int32"); parametersForCopyToMethod.Add("System.Char[]"); parametersForCopyToMethod.Add("System.NotAnInt32"); parametersForCopyToMethod.Add("System.Int32"); MethodSignatureMatchingRule matchingRule = new MethodSignatureMatchingRule(parametersForCopyToMethod); Assert.IsFalse(matchingRule.Matches(stringCopyToMethod)); }
public void CanMatchOnMultipleParameterTypes() { List <string> parametersForCopyToMethod = new List <string>(); parametersForCopyToMethod.Add("System.Int32"); parametersForCopyToMethod.Add("System.Char[]"); parametersForCopyToMethod.Add("System.Int32"); parametersForCopyToMethod.Add("System.Int32"); MethodSignatureMatchingRule matchingRule = new MethodSignatureMatchingRule(parametersForCopyToMethod); Assert.IsTrue(matchingRule.Matches(stringCopyToMethod)); }
/// <summary> /// Builds an instance of the subtype of IMatchingRule type that the receiver knows how to build, based on /// an a configuration object. /// </summary> /// <param name="context">The <see cref="IBuilderContext"/> that represents the current building process.</param> /// <param name="objectConfiguration">The configuration object that describes the object to build.</param> /// <param name="configurationSource">The source for configuration objects.</param> /// <param name="reflectionCache">The cache to use retrieving reflection information.</param> /// <returns>A fully initialized instance of the IMatchingRule subtype.</returns> public IMatchingRule Assemble(IBuilderContext context, MatchingRuleData objectConfiguration, IConfigurationSource configurationSource, ConfigurationReflectionCache reflectionCache) { MethodSignatureMatchingRuleData castedRuleData = (MethodSignatureMatchingRuleData)objectConfiguration; List <string> parameterTypes = new List <string>(); foreach (ParameterTypeElement parameterType in castedRuleData.Parameters) { parameterTypes.Add(parameterType.ParameterTypeName); } MethodSignatureMatchingRule matchingRule = new MethodSignatureMatchingRule(castedRuleData.Match, parameterTypes, castedRuleData.IgnoreCase); return(matchingRule); }
public void CanMatchOnParameterlessMethods() { List<string> parameterLess = new List<string>(); MethodSignatureMatchingRule matchingRule = new MethodSignatureMatchingRule(parameterLess); Assert.IsTrue(matchingRule.Matches(objectToStringMethod)); }