Ejemplo n.º 1
0
        public static SubstituteState Create(ISubstitutionContext substitutionContext)
        {
            var substituteFactory = substitutionContext.GetSubstituteFactory();
            var callInfoFactory = new CallInfoFactory();
            var callStack = new CallStack();
            var callResults = new CallResults(callInfoFactory);
            var callSpecificationFactory = NewCallSpecificationFactory();

            var callFormatter = new CallFormatter(new ArgumentsFormatter(new ArgumentFormatter()));

            var state = new object[]
            {
                callInfoFactory,
                callStack,
                callResults,
                callSpecificationFactory,
                substituteFactory,
                new CallActions(),
                new PropertyHelper(),
                new ResultSetter(callStack, callResults, callSpecificationFactory),
                new EventHandlerRegistry(),
                new CallNotReceivedExceptionThrower(callFormatter),
                new CallReceivedExceptionThrower(callFormatter),
                new DefaultForType(),
                new IAutoValueProvider[] { new AutoSubstituteProvider(substituteFactory), new AutoStringProvider(), new AutoArrayProvider()}
            };

            return new SubstituteState(state);
        }