示例#1
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();
        }
示例#2
0
        private SubstitutionContext()
        {
            ThreadContext = new ThreadLocalContext();
            var callSpecificationFactory = CallSpecificationFactoryFactoryYesThatsRight.CreateCallSpecFactory();

            _callRouterResolver = new CallRouterResolver();

            var sequenceNumberGenerator = new SequenceNumberGenerator();

#pragma warning disable 618 // Obsolete
            SequenceNumberGenerator = sequenceNumberGenerator;
#pragma warning restore 618 // Obsolete

            RouteFactory = new RouteFactory(sequenceNumberGenerator, ThreadContext, callSpecificationFactory);

            var callInfoFactory           = new CallInfoFactory();
            var autoValueProvidersFactory = new AutoValueProvidersFactory();
            var substituteStateFactory    = new SubstituteStateFactory(callSpecificationFactory, callInfoFactory, autoValueProvidersFactory);
            var callRouterFactory         = new CallRouterFactory(ThreadContext, RouteFactory);
            var argSpecificationQueue     = new ArgumentSpecificationDequeue(ThreadContext.DequeueAllArgumentSpecifications);
            var dynamicProxyFactory       = new CastleDynamicProxyFactory(argSpecificationQueue);
            var delegateFactory           = new DelegateProxyFactory(dynamicProxyFactory);
            var proxyFactory = new ProxyFactory(delegateFactory, dynamicProxyFactory);
            SubstituteFactory = new SubstituteFactory(substituteStateFactory, callRouterFactory, proxyFactory);
        }
示例#3
0
 public SubstituteStateFactory(SequenceNumberGenerator sequenceNumberGenerator,
                               ICallSpecificationFactory callSpecificationFactory,
                               ICallInfoFactory callInfoFactory,
                               IAutoValueProvidersFactory autoValueProvidersFactory)
 {
     _sequenceNumberGenerator   = sequenceNumberGenerator;
     _callSpecificationFactory  = callSpecificationFactory;
     _callInfoFactory           = callInfoFactory;
     _autoValueProvidersFactory = autoValueProvidersFactory;
 }
示例#4
0
        public SubstitutionContext(ISubstituteFactory substituteFactory,
                                   IRouteFactory routeFactory,
                                   IThreadLocalContext threadLocalContext,
                                   ICallRouterResolver callRouterResolver)
        {
            SubstituteFactory   = substituteFactory ?? throw new ArgumentNullException(nameof(substituteFactory));
            RouteFactory        = routeFactory ?? throw new ArgumentNullException(nameof(routeFactory));
            ThreadContext       = threadLocalContext ?? throw new ArgumentNullException(nameof(threadLocalContext));
            _callRouterResolver = callRouterResolver ?? throw new ArgumentNullException(nameof(callRouterResolver));

#pragma warning disable 618 // Obsolete
            SequenceNumberGenerator = new SequenceNumberGenerator();
#pragma warning restore 618 // Obsolete
        }
示例#5
0
        public SubstitutionContext(ISubstituteFactory substituteFactory,
                                   IRouteFactory routeFactory,
                                   ICallSpecificationFactory callSpecificationFactory,
                                   IThreadLocalContext threadLocalContext,
                                   ICallRouterResolver callRouterResolver,
                                   SequenceNumberGenerator sequenceNumberGenerator)
        {
            SubstituteFactory        = substituteFactory;
            RouteFactory             = routeFactory;
            CallSpecificationFactory = callSpecificationFactory;
            ThreadContext            = threadLocalContext;
            _callRouterResolver      = callRouterResolver;

#pragma warning disable 618 // Obsolete
            SequenceNumberGenerator = sequenceNumberGenerator;
#pragma warning restore 618 // Obsolete
        }
 public RecordCallHandler(ICallStack callStack, SequenceNumberGenerator generator)
 {
     _callStack = callStack;
     _generator = generator;
 }
 public RecordCallHandler(ICallCollection callCollection, SequenceNumberGenerator generator)
 {
     _callCollection = callCollection;
     _generator = generator;
 }