public override void Because() { base.Because(); _callRouter.stub(c => c.IsLastCallInfoPresent()).Return(false); sut.LastCallRouter(_callRouter); }
public override void Context() { base.Context(); _callRouter = mock <ICallRouter>(); _callRouter.stub(c => c.IsLastCallInfoPresent()).Return(true); _valueToReturn = mock <IReturn>(); }
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); }
public void Should_forward_call_with_original_arguments_to_router_and_return_value_from_route() { const int aNumber = 5; const string aString = "Some string"; const string returnFromRoute = "value from route"; var call = Arg <ICall> .Matches(c => CallWasToMethodNamed(c, "Bar") && CallArgsWere(c, new object[] { aNumber, aString })); _callRouter.stub(x => x.Route(call)).Return(returnFromRoute); var returnValue = _result.Bar(aNumber, aString); Assert.That(returnValue, Is.EqualTo(returnFromRoute)); }