Example #1
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();
            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
            };
        }
        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
                new AutoObservableProvider(() => AutoValueProviders),
#endif
                new AutoSubstituteProvider(substituteFactory),
                new AutoStringProvider(),
                new AutoArrayProvider(),
#if (NET4 || NET45)
                new AutoTaskProvider(() => AutoValueProviders),
#endif
            };
        }
Example #3
0
            public override void Context()
            {
                _context        = mock <ISubstitutionContext>();
                _call           = mock <ICall>();
                _state          = mock <ISubstituteState>();
                _receivedCalls  = mock <IReceivedCalls>();
                ConfigureCall   = mock <IConfigureCall>();
                _routeFactory   = mock <IRouteFactory>();
                _resultsForType = mock <IResultsForType>();
                _state.stub(x => x.ReceivedCalls).Return(_receivedCalls);
                _state.stub(x => x.ConfigureCall).Return(ConfigureCall);
                _state.stub(x => x.ResultsForType)
                .Return(_resultsForType);
                var recordReplayRoute = CreateRouteThatReturns(_returnValueFromRecordReplayRoute);

                recordReplayRoute.stub(x => x.IsRecordReplayRoute).Return(true);
                _routeFactory.stub(x => x.RecordReplay(_state)).Return(recordReplayRoute);
            }
Example #4
0
 public ReturnResultForTypeHandler(IResultsForType resultsForType)
 {
     _resultsForType = resultsForType;
 }
 public ReturnResultForTypeHandler(IResultsForType resultsForType)
 {
     _resultsForType = resultsForType;
 }
Example #6
0
 public override void Context()
 {
     _call           = mock <ICall>();
     _resultsForType = mock <IResultsForType>();
 }