public override void Context()
        {
            _routerForSubstitute = new TestCallRouter();
            _substitute          = mock <IFoo>();
            _context             = mock <ISubstitutionContext>();
            _routeFactory        = mock <IRouteFactory>();

            _context.stub(x => x.GetCallRouterFor(_substitute)).Return(_routerForSubstitute);
            _context.stub(x => x.GetRouteFactory()).Return(_routeFactory);

            temporarilyChange(() => SubstitutionContext.Current).to(_context);
        }
        public override void Context()
        {
            _routerForSubstitute = new TestCallRouter();
            _substitute = mock<IFoo>();
            _context = mock<ISubstitutionContext>();
            _routeFactory = mock<IRouteFactory>();

            _context.stub(x => x.GetCallRouterFor(_substitute)).Return(_routerForSubstitute);
            _context.stub(x => x.GetRouteFactory()).Return(_routeFactory);

            temporarilyChange(() => SubstitutionContext.Current).to(_context);
        }
Ejemplo n.º 3
0
            public override void Context()
            {
                _call = mock <Action <IFoo> >();
                _callbackWithArguments = args => { };
                _matchArgs             = MatchArgs.AsSpecifiedInCall;

                _callRouter   = new TestCallRouter();
                _context      = mock <ISubstitutionContext>();
                _routeFactory = mock <IRouteFactory>();
                _substitute   = mock <IFoo>();

                _context.stub(x => x.GetCallRouterFor(_substitute)).Return(_callRouter);
                _context.stub(x => x.GetRouteFactory()).Return(_routeFactory);
            }
Ejemplo n.º 4
0
 public override void Context()
 {
     _substitute = mock<Foo>();
     _substituteFactory = mock<ISubstituteFactory>();
     _substituteFactory.stub(x => x.Create<Foo>()).Return(_substitute);
     _context = mock<ISubstitutionContext>();
     _context.stub(x => x.GetSubstituteFactory()).Return(_substituteFactory);
     temporarilyChange(() => SubstitutionContext.Current).to(_context);
 }
Ejemplo n.º 5
0
 public override void Context()
 {
     _value = new object();
     _substitutionContext = mock<ISubstitutionContext>();
     _substitutionContext
         .stub(x => x.LastCallShouldReturn(It.IsAny<IReturn>(), It.IsAny<MatchArgs>()))
         .IgnoreArguments()
         .WhenCalled(x => _returnValueSet = (IReturn) x.Arguments[0]);
     temporarilyChange(() => SubstitutionContext.Current).to(_substitutionContext);
 }
Ejemplo n.º 6
0
 public override void Context()
 {
     _value = new object();
     _substitutionContext = mock <ISubstitutionContext>();
     _substitutionContext
     .stub(x => x.LastCallShouldReturn(It.IsAny <IReturn>(), It.IsAny <MatchArgs>()))
     .IgnoreArguments()
     .WhenCalled(x => _returnValueSet = (IReturn)x.Arguments[0]);
     temporarilyChange(() => SubstitutionContext.Current).to(_substitutionContext);
 }
Ejemplo n.º 7
0
 public override void Context()
 {
     _types = new[] { typeof(Foo) };
     _constructorArgs = new[] { new object() };
     _substitute = mock<Foo>();
     _substituteFactory = mock<ISubstituteFactory>();
     _substituteFactory.stub(x => x.Create(_types, _constructorArgs)).Return(_substitute);
     _context = mock<ISubstitutionContext>();
     _context.stub(x => x.GetSubstituteFactory()).Return(_substituteFactory);
     temporarilyChange(() => SubstitutionContext.Current).to(_context);
 }
Ejemplo n.º 8
0
 public override void Context()
 {
     _types             = new[] { typeof(Foo) };
     _constructorArgs   = new[] { new object() };
     _substitute        = mock <Foo>();
     _substituteFactory = mock <ISubstituteFactory>();
     _substituteFactory.stub(x => x.Create(_types, _constructorArgs)).Return(_substitute);
     _context = mock <ISubstitutionContext>();
     _context.stub(x => x.SubstituteFactory).Return(_substituteFactory);
     temporarilyChange(() => SubstitutionContext.Current).to(_context);
 }
Ejemplo n.º 9
0
 public override void Context()
 {
     substitute = mock<Foo>();
     substituteFactory = mock<ISubstituteFactory>();
     substituteFactory.stub(x => x.Create<Foo>()).Return(substitute);
     context = mock<ISubstitutionContext>();
     context.stub(x => x.GetSubstituteFactory()).Return(substituteFactory);
     temporarilyChange(SubstitutionContext.Current)
         .to(context)
         .via(x => SubstitutionContext.Current = x);
 }
 public override void Context()
 {
     _sub = mock <IFoo>();
     _substitutionContext = mock <ISubstitutionContext>();
     _callRouter          = mock <ICallRouter>();
     _substitutionContext.stub(x => x.GetCallRouterFor(_sub))
     .IgnoreArguments()
     .Return(_callRouter);
     _callRouter.stub(x => x.SetReturnForType(It.IsAny <Type>(), It.IsAny <IReturn>()))
     .IgnoreArguments()
     .WhenCalled(x => _returnValueSet = (IReturn)x.Arguments[1]);
     temporarilyChange(() => SubstitutionContext.Current).to(_substitutionContext);
 }
 public override void Context()
 {
     _sub = mock<IFoo>();
     _substitutionContext = mock<ISubstitutionContext>();
     _callRouter = mock<ICallRouter>();
     _substitutionContext.stub(x => x.GetCallRouterFor(_sub))
                         .IgnoreArguments()
                         .Return(_callRouter);
     _callRouter.stub(x => x.SetReturnForType(It.IsAny<Type>(), It.IsAny<IReturn>()))
                .IgnoreArguments()
                .WhenCalled(x => _returnValueSet = (IReturn)x.Arguments[1]);
     temporarilyChange(() => SubstitutionContext.Current).to(_substitutionContext);
 }