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); }
public ICallRouter GetCallRouterFor(object substitute) { return(SubstituteFactory.GetCallRouterCreatedFor(substitute)); }