Esempio n. 1
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);
        }
Esempio n. 2
0
 public CallRouter(ISubstituteState substituteState, IThreadLocalContext threadContext, IRouteFactory routeFactory, bool canConfigureBaseCalls)
 {
     _substituteState       = substituteState;
     _threadContext         = threadContext;
     _routeFactory          = routeFactory;
     _canConfigureBaseCalls = canConfigureBaseCalls;
 }
Esempio n. 3
0
        public CallRouter(ISubstituteState substituteState, IThreadLocalContext threadContext, IRouteFactory routeFactory)
        {
            _substituteState = substituteState;
            _threadContext   = threadContext;
            _routeFactory    = routeFactory;

            UseDefaultRouteForNextCall();
        }
Esempio n. 4
0
 public WhenCalled(ISubstitutionContext context, T substitute, Action <T> call, MatchArgs matchArgs)
 {
     _substitute    = substitute;
     _call          = call;
     _matchArgs     = matchArgs;
     _callRouter    = context.GetCallRouterFor(substitute !);
     _routeFactory  = context.RouteFactory;
     _threadContext = context.ThreadContext;
 }
Esempio n. 5
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
        }
Esempio n. 6
0
 public RouteFactory(SequenceNumberGenerator sequenceNumberGenerator,
                     IThreadLocalContext threadLocalContext,
                     ICallSpecificationFactory callSpecificationFactory,
                     IReceivedCallsExceptionThrower receivedCallsExceptionThrower,
                     IPropertyHelper propertyHelper,
                     IDefaultForType defaultForType)
 {
     _sequenceNumberGenerator       = sequenceNumberGenerator;
     _threadLocalContext            = threadLocalContext;
     _callSpecificationFactory      = callSpecificationFactory;
     _receivedCallsExceptionThrower = receivedCallsExceptionThrower;
     _propertyHelper = propertyHelper;
     _defaultForType = defaultForType;
 }
Esempio n. 7
0
 public RouteFactory(SequenceNumberGenerator sequenceNumberGenerator,
                     IThreadLocalContext threadLocalContext,
                     ICallSpecificationFactory callSpecificationFactory,
                     IReceivedCallsExceptionThrower receivedCallsExceptionThrower,
                     IPropertyHelper propertyHelper,
                     IDefaultForType defaultForType)
 {
     _sequenceNumberGenerator       = sequenceNumberGenerator ?? throw new ArgumentNullException(nameof(sequenceNumberGenerator));
     _threadLocalContext            = threadLocalContext ?? throw new ArgumentNullException(nameof(threadLocalContext));
     _callSpecificationFactory      = callSpecificationFactory ?? throw new ArgumentNullException(nameof(callSpecificationFactory));
     _receivedCallsExceptionThrower = receivedCallsExceptionThrower ?? throw new ArgumentNullException(nameof(receivedCallsExceptionThrower));
     _propertyHelper = propertyHelper ?? throw new ArgumentNullException(nameof(propertyHelper));
     _defaultForType = defaultForType ?? throw new ArgumentNullException(nameof(defaultForType));
 }
Esempio n. 8
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 DiagnosticsThreadLocalContext(IThreadLocalContext impl, DiagContextInternal ctx)
 {
     _impl = impl;
     _ctx  = ctx;
     PendingSpecification = new DiagnosticsPendingSpecification(impl.PendingSpecification, ctx);
 }
Esempio n. 10
0
 public CallRouterFactory(IThreadLocalContext threadLocalContext, IRouteFactory routeFactory)
 {
     _threadLocalContext = threadLocalContext;
     _routeFactory       = routeFactory;
 }
Esempio n. 11
0
 public RouteFactory(IThreadLocalContext threadLocalContext, ICallSpecificationFactory callSpecificationFactory)
 {
     _threadLocalContext       = threadLocalContext ?? throw new ArgumentNullException(nameof(threadLocalContext));
     _callSpecificationFactory = callSpecificationFactory ?? throw new ArgumentNullException(nameof(callSpecificationFactory));
 }
Esempio n. 12
0
 public CallRouterFactory(IThreadLocalContext threadLocalContext, IRouteFactory routeFactory)
 {
     _threadLocalContext = threadLocalContext ?? throw new ArgumentNullException(nameof(threadLocalContext));
     _routeFactory       = routeFactory ?? throw new ArgumentNullException(nameof(routeFactory));
 }
 public ClearLastCallRouterHandler(IThreadLocalContext threadContext)
 {
     _threadContext = threadContext;
 }
 public AddCallToQueryResultHandler(IThreadLocalContext threadContext)
 {
     _threadContext = threadContext;
 }
Esempio n. 15
0
 public RouteFactory(SequenceNumberGenerator sequenceNumberGenerator, IThreadLocalContext threadLocalContext, ICallSpecificationFactory callSpecificationFactory)
 {
     _sequenceNumberGenerator  = sequenceNumberGenerator ?? throw new ArgumentNullException(nameof(sequenceNumberGenerator));
     _threadLocalContext       = threadLocalContext ?? throw new ArgumentNullException(nameof(threadLocalContext));
     _callSpecificationFactory = callSpecificationFactory ?? throw new ArgumentNullException(nameof(callSpecificationFactory));
 }