コード例 #1
0
 public IArgumentSpecification Create(object argument, IParameterInfo parameterInfo, ISuppliedArgumentSpecifications suppliedArgumentSpecifications)
 {
     if (_defaultChecker.IsDefault(argument, parameterInfo.ParameterType))
     {
         if (suppliedArgumentSpecifications.IsNextFor(argument, parameterInfo.ParameterType))
         {
             var argumentSpecification = suppliedArgumentSpecifications.Dequeue();
             if (suppliedArgumentSpecifications.DequeueRemaining().Count() == 0)
             {
                 return(argumentSpecification);
             }
         }
         else if (!suppliedArgumentSpecifications.AnyFor(argument, parameterInfo.ParameterType))
         {
             if (suppliedArgumentSpecifications.DequeueRemaining().Count() == 0)
             {
                 return(_argumentEqualsSpecificationFactory.Create(argument, parameterInfo.ParameterType));
             }
         }
     }
     else
     {
         var paramterInfosFromParamsArray = _parameterInfosFromParamsArrayFactory.Create(argument, parameterInfo.ParameterType);
         var suppliedArgumentSpecificationsFromParamsArray = _suppliedArgumentSpecificationsFactory.Create(suppliedArgumentSpecifications.DequeueRemaining());
         var arrayArgumentSpecifications = _arrayArgumentSpecificationsFactory.Create(argument, paramterInfosFromParamsArray, suppliedArgumentSpecificationsFromParamsArray);
         return(_arrayContentsArgumentSpecificationFactory.Create(arrayArgumentSpecifications, parameterInfo.ParameterType));
     }
     throw new AmbiguousArgumentsException();
 }
コード例 #2
0
 private bool IsProvidedArgumentTheOneWeWouldGetUsingAnArgSpecForThisType(object argument, Type typeArgSpecIsFor)
 {
     return(_defaultChecker.IsDefault(argument, typeArgSpecIsFor));
 }