private IArgumentSpecification ConvertArgSpecToMatchAnyInstanceOfParameterType(ParameterInfo parameter, IArgumentSpecification spec) { return new ArgumentIsAnythingSpecification(parameter.ParameterType) { Action = x => RunActionIfTypeIsCompatible(x, spec.Action, spec.ForType) }; }
private IEnumerable<string> Format(object[] args, IArgumentSpecification[] specs) { return args.Select((arg, index) => { var hasSpecForThisArg = index < specs.Length; return hasSpecForThisArg ? specs[index].FormatArgument(arg) : DefaultArgumentFormatter.Format(arg, true); }); }
public void EnqueueArgumentSpecification(IArgumentSpecification spec) { _argumentSpecifications.Value.Add(spec); }
private bool DoesArgSpecLookLikeItCouldBeForThisArgumentAndType(IArgumentSpecification argSpec, object argument, Type argumentType) { var typeArgSpecIsFor = argSpec.ForType; return AreTypesCompatible(argumentType, typeArgSpecIsFor) && IsProvidedArgumentTheOneWeWouldGetUsingAnArgSpecForThisType(argument, typeArgSpecIsFor); }
public ArgumentMatchInfo(int index, object argument, IArgumentSpecification specification) { Index = index; _argument = argument; _specification = specification; }
private IArgumentFormatInfo CreateArgumentSpecificationParamsArrayFormatInfo(IArgumentSpecification argumentSpecification, bool isHighlighted) { return new ArgumentSpecificationParamsArrayFormatInfo(argumentSpecification, isHighlighted); }
public ArgumentSpecificationFormatInfo(IArgumentSpecification argumentSpecification, bool isHighlighted) { _argumentSpecification = argumentSpecification; _isHighlighted = isHighlighted; }
public void EnqueueArgumentSpecification(IArgumentSpecification spec) { innerContext.EnqueueArgumentSpecification(spec); }
public void EnqueueArgumentSpecification(IArgumentSpecification spec) => ThreadContext.EnqueueArgumentSpecification(spec);
private T EnqueueSpecFor <T>(IArgumentSpecification argumentSpecification) { _substitutionContext.ThreadContext.EnqueueArgumentSpecification(argumentSpecification); return(default(T)); }
public void EnqueueArgumentSpecification(IArgumentSpecification spec) { _argumentSpecifications.Value.Add(spec); }
private bool DoesArgSpecLookLikeItCouldBeForThisArgumentAndType(IArgumentSpecification argSpec, object argument, Type argumentType) { var typeArgSpecIsFor = argSpec.ForType; return(AreTypesCompatible(argumentType, typeArgSpecIsFor) && IsProvidedArgumentTheOneWeWouldGetUsingAnArgSpecForThisType(argument, typeArgSpecIsFor)); }