コード例 #1
0
        public SubstituteState(ISubstitutionContext substitutionContext, SubstituteConfig option)
        {
            SubstitutionContext     = substitutionContext;
            SubstituteConfig        = option;
            SequenceNumberGenerator = substitutionContext.SequenceNumberGenerator;
            var substituteFactory = substitutionContext.SubstituteFactory;
            var callInfoFactory   = new CallInfoFactory();

            var callCollection = new CallCollection();

            CallCollection = callCollection;
            ReceivedCalls  = callCollection;

            PendingSpecification     = new PendingSpecification(substitutionContext);
            CallResults              = new CallResults(callInfoFactory);
            AutoValuesCallResults    = new CallResults(callInfoFactory);
            CallSpecificationFactory = CallSpecificationFactoryFactoryYesThatsRight.CreateCallSpecFactory();
            CallActions              = new CallActions(callInfoFactory);
            CallBaseExclusions       = new CallBaseExclusions();
            ResultsForType           = new ResultsForType(callInfoFactory);
            CustomHandlers           = new CustomHandlers(this);
            var getCallSpec = new GetCallSpec(callCollection, PendingSpecification, CallSpecificationFactory, CallActions);

            ConfigureCall        = new ConfigureCall(CallResults, CallActions, getCallSpec);
            EventHandlerRegistry = new EventHandlerRegistry();

            AutoValueProviders = new IAutoValueProvider[] {
                new AutoObservableProvider(() => AutoValueProviders),
                new AutoQueryableProvider(),
                new AutoSubstituteProvider(substituteFactory),
                new AutoStringProvider(),
                new AutoArrayProvider(),
                new AutoTaskProvider(() => AutoValueProviders),
            };
        }
コード例 #2
0
ファイル: SubstituteState.cs プロジェクト: appel1/NSubstitute
        public SubstituteState(ISubstitutionContext substitutionContext, SubstituteConfig option)
        {
            SubstitutionContext = substitutionContext;
            SubstituteConfig = option;
            SequenceNumberGenerator = substitutionContext.SequenceNumberGenerator;
            var substituteFactory = substitutionContext.SubstituteFactory;
            var callInfoFactory = new CallInfoFactory();
            var callStack = new CallStack();
            CallStack = callStack;
            ReceivedCalls = callStack;
            PendingSpecification = new PendingSpecification();
            CallResults = new CallResults(callInfoFactory);
            CallSpecificationFactory = CallSpecificationFactoryFactoryYesThatsRight.CreateCallSpecFactory();
            CallActions = new CallActions(callInfoFactory);
            CallBaseExclusions = new CallBaseExclusions();
            ResultsForType = new ResultsForType(callInfoFactory);

            var getCallSpec = new GetCallSpec(callStack, PendingSpecification, CallSpecificationFactory, CallActions);

            ConfigureCall = new ConfigureCall(CallResults, CallActions, getCallSpec);
            EventHandlerRegistry = new EventHandlerRegistry();
            AutoValueProviders = new IAutoValueProvider[] { 
#if NET45 || NETSTANDARD1_5
                new AutoObservableProvider(() => AutoValueProviders),
                new AutoQueryableProvider(),
#endif
                new AutoSubstituteProvider(substituteFactory), 
                new AutoStringProvider(), 
                new AutoArrayProvider(),
#if (NET4 || NET45 || NETSTANDARD1_5)
                new AutoTaskProvider(() => AutoValueProviders),
#endif
            };
        }
コード例 #3
0
        public SubstituteState(
            SubstituteConfig option,
            SequenceNumberGenerator sequenceNumberGenerator,
            ICallSpecificationFactory callSpecificationFactory,
            ICallInfoFactory callInfoFactory,
            IReadOnlyCollection <IAutoValueProvider> autoValueProviders)
        {
            SubstituteConfig        = option;
            SequenceNumberGenerator = sequenceNumberGenerator;
            AutoValueProviders      = autoValueProviders;

            var callCollection = new CallCollection();

            ReceivedCalls = callCollection;

            CallResults           = new CallResults(callInfoFactory);
            AutoValuesCallResults = new CallResults(callInfoFactory);
            CallActions           = new CallActions(callInfoFactory);
            CallBaseExclusions    = new CallBaseExclusions();
            ResultsForType        = new ResultsForType(callInfoFactory);
            CustomHandlers        = new CustomHandlers(this);
            var getCallSpec = new GetCallSpec(callCollection, callSpecificationFactory, CallActions);

            ConfigureCall        = new ConfigureCall(CallResults, CallActions, getCallSpec);
            EventHandlerRegistry = new EventHandlerRegistry();
        }
コード例 #4
0
        public SubstituteState(ISubstitutionContext substitutionContext, SubstituteConfig option)
        {
            SubstitutionContext     = substitutionContext;
            SubstituteConfig        = option;
            SequenceNumberGenerator = substitutionContext.SequenceNumberGenerator;
            var substituteFactory = substitutionContext.SubstituteFactory;
            var callInfoFactory   = new CallInfoFactory();
            var callStack         = new CallStack();

            CallStack                = callStack;
            ReceivedCalls            = callStack;
            PendingSpecification     = new PendingSpecification();
            CallResults              = new CallResults(callInfoFactory);
            CallSpecificationFactory = CallSpecificationFactoryFactoryYesThatsRight.CreateCallSpecFactory();
            CallActions              = new CallActions(callInfoFactory);
            CallBaseExclusions       = new CallBaseExclusions();

            var getCallSpec = new GetCallSpec(callStack, PendingSpecification, CallSpecificationFactory, CallActions);

            ConfigureCall        = new ConfigureCall(CallResults, CallActions, getCallSpec);
            EventHandlerRegistry = new EventHandlerRegistry();
            AutoValueProviders   = new IAutoValueProvider[] {
#if NET45
                new AutoObservableProvider(() => AutoValueProviders),
#endif
                new AutoSubstituteProvider(substituteFactory),
                new AutoStringProvider(),
                new AutoArrayProvider(),
#if (NET4 || NET45)
                new AutoTaskProvider(() => AutoValueProviders),
#endif
            };
        }