public override void Context()
 {
     base.Context();
     _parameterInfo = mock <IParameterInfo>();
     _argumentEqualsSpecificationFactory = mock <IArgumentEqualsSpecificationFactory>();
     _suppliedArgumentSpecifications     = mock <ISuppliedArgumentSpecifications>();
 }
 public ParamsArgumentSpecificationFactory(IArgumentEqualsSpecificationFactory argumentEqualsSpecificationFactory,
                                           IArrayArgumentSpecificationsFactory arrayArgumentSpecificationsFactory,
                                           IParameterInfosFromParamsArrayFactory parameterInfosFromParamsArrayFactory,
                                           IArrayContentsArgumentSpecificationFactory arrayContentsArgumentSpecificationFactory)
 {
     _argumentEqualsSpecificationFactory        = argumentEqualsSpecificationFactory;
     _arrayArgumentSpecificationsFactory        = arrayArgumentSpecificationsFactory;
     _parameterInfosFromParamsArrayFactory      = parameterInfosFromParamsArrayFactory;
     _arrayContentsArgumentSpecificationFactory = arrayContentsArgumentSpecificationFactory;
 }
 public ParamsArgumentSpecificationFactory(IDefaultChecker defaultChecker,
                                         IArgumentEqualsSpecificationFactory argumentEqualsSpecificationFactory,
                                         IArrayArgumentSpecificationsFactory arrayArgumentSpecificationsFactory,
                                         IParameterInfosFromParamsArrayFactory parameterInfosFromParamsArrayFactory,
                                         ISuppliedArgumentSpecificationsFactory suppliedArgumentSpecificationsFactory,
                                         IArrayContentsArgumentSpecificationFactory arrayContentsArgumentSpecificationFactory)
 {
     _defaultChecker = defaultChecker;
     _argumentEqualsSpecificationFactory = argumentEqualsSpecificationFactory;
     _arrayArgumentSpecificationsFactory = arrayArgumentSpecificationsFactory;
     _parameterInfosFromParamsArrayFactory = parameterInfosFromParamsArrayFactory;
     _suppliedArgumentSpecificationsFactory = suppliedArgumentSpecificationsFactory;
     _arrayContentsArgumentSpecificationFactory = arrayContentsArgumentSpecificationFactory;
 }
Пример #4
0
 public ParamsArgumentSpecificationFactory(IDefaultChecker defaultChecker,
                                           IArgumentEqualsSpecificationFactory argumentEqualsSpecificationFactory,
                                           IArrayArgumentSpecificationsFactory arrayArgumentSpecificationsFactory,
                                           IParameterInfosFromParamsArrayFactory parameterInfosFromParamsArrayFactory,
                                           ISuppliedArgumentSpecificationsFactory suppliedArgumentSpecificationsFactory,
                                           IArrayContentsArgumentSpecificationFactory arrayContentsArgumentSpecificationFactory)
 {
     _defaultChecker = defaultChecker;
     _argumentEqualsSpecificationFactory        = argumentEqualsSpecificationFactory;
     _arrayArgumentSpecificationsFactory        = arrayArgumentSpecificationsFactory;
     _parameterInfosFromParamsArrayFactory      = parameterInfosFromParamsArrayFactory;
     _suppliedArgumentSpecificationsFactory     = suppliedArgumentSpecificationsFactory;
     _arrayContentsArgumentSpecificationFactory = arrayContentsArgumentSpecificationFactory;
 }
 public override void Context()
 {
     base.Context();
     _argument      = new[] { "one", "two", "three" };
     _parameterInfo = mock <IParameterInfo>();
     _parameterInfo.stub(x => x.ParameterType).Return(typeof(string[]));
     _argumentEqualsSpecificationFactory        = mock <IArgumentEqualsSpecificationFactory>();
     _arrayArgumentSpecificationsFactory        = mock <IArrayArgumentSpecificationsFactory>();
     _parameterInfosFromParamsArrayFactory      = mock <IParameterInfosFromParamsArrayFactory>();
     SuppliedArgumentSpecificationsFactory      = mock <ISuppliedArgumentSpecificationsFactory>();
     _arrayContentsArgumentSpecificationFactory = mock <IArrayContentsArgumentSpecificationFactory>();
     _defaultChecker = mock <IDefaultChecker>();
     _argumentSpecificationsToSupply = new Queue <IArgumentSpecification>();
     _suppliedArgumentSpecifications = mock <ISuppliedArgumentSpecifications>();
     _suppliedArgumentSpecifications.stub(x => x.Dequeue()).Return(null).WhenCalled(x => x.ReturnValue          = _argumentSpecificationsToSupply.Dequeue());
     _suppliedArgumentSpecifications.stub(x => x.DequeueRemaining()).Return(null).WhenCalled(x => x.ReturnValue = _argumentSpecificationsToSupply);
 }
Пример #6
0
        /// <summary>
        /// Updates the <see cref="IArgumentEqualsSpecificationFactory"/> from the defaults.
        /// </summary>
        /// <param name="substituteState">The instance to update.</param>
        /// <param name="argumentEqualsSpecificationFactory">The new factory to use.</param>
        /// <returns>The updates state so that method chaining can occur.</returns>
        public static SubstituteState UpdateArgumentEqualsSpecificationFactory(this SubstituteState substituteState, IArgumentEqualsSpecificationFactory argumentEqualsSpecificationFactory)
        {
            var argumentSpecificationFactory = substituteState
                                               .CallSpecificationFactory
                                               .GetPrivateFieldValue("_argumentSpecificationsFactory")
                                               .GetPrivateFieldValue("_mixedArgumentSpecificationsFactory")
                                               .GetPrivateFieldValue("_argumentSpecificationFactory");

            argumentSpecificationFactory
            .GetPrivateFieldValue("_paramsArgumentSpecificationFactory")
            .SetPrivateFieldValue("_argumentEqualsSpecificationFactory", argumentEqualsSpecificationFactory)
            .GetPrivateFieldValue("_arrayArgumentSpecificationsFactory")
            .GetPrivateFieldValue("_nonParamsArgumentSpecificationFactory")
            .SetPrivateFieldValue("_argumentEqualsSpecificationFactory", argumentEqualsSpecificationFactory);

            argumentSpecificationFactory
            .GetPrivateFieldValue("_nonParamsArgumentSpecificationFactory")
            .SetPrivateFieldValue("_argumentEqualsSpecificationFactory", argumentEqualsSpecificationFactory);

            return(substituteState);
        }
Пример #7
0
 public NonParamsArgumentSpecificationFactory(IArgumentEqualsSpecificationFactory argumentEqualsSpecificationFactory)
 {
     _argumentEqualsSpecificationFactory = argumentEqualsSpecificationFactory;
 }
 public NonParamsArgumentSpecificationFactory(IArgumentEqualsSpecificationFactory argumentEqualsSpecificationFactory)
 {
     _argumentEqualsSpecificationFactory = argumentEqualsSpecificationFactory;
 }
 public NonParamsArgumentSpecificationFactory(IDefaultChecker defaultChecker, IArgumentEqualsSpecificationFactory argumentEqualsSpecificationFactory)
 {
     _defaultChecker = defaultChecker;
     _argumentEqualsSpecificationFactory = argumentEqualsSpecificationFactory;
 }