protected override void beforeEach() { theInput = new PartialInputModel(); theAction = MockFor <IActionBehavior>(); MockFor <IFubuRequest>().Stub(x => x.Get <PartialInputModel>()).Return(theInput); MockFor <IAuthorizationPreviewService>().Expect(x => x.IsAuthorized(theInput)).Return(false); MockFor <IPartialFactory>().Stub(x => x.BuildPartial(typeof(PartialInputModel))).Return(theAction); theOutput = ClassUnderTest.InvokeObject(theInput); }
protected override void beforeEach() { theInput = new PartialInputModel(); MockFor <IAuthorizationPreviewService>().Expect(x => x.IsAuthorized(theInput)).Return(true); MockFor <IPartialFactory>().Stub(x => x.BuildPartial(typeof(PartialInputModel))).Return( MockFor <IActionBehavior>()); Services.Inject <ITypeResolver>(new TypeResolver()); ClassUnderTest.InvokeObject(theInput); }
protected override void beforeEach() { theInput = new PartialInputModel(); theAction = MockFor <IActionBehavior>(); MockFor <IFubuRequest>().Stub(x => x.Get <PartialInputModel>()).Return(theInput); MockFor <IAuthorizationPreviewService>().Expect(x => x.IsAuthorized(theInput)).Return(false); theChain = new BehaviorChain(); MockFor <IRecordedOutput>().Stub(x => x.Headers()).Return(Enumerable.Empty <Header>()); MockFor <IPartialFactory>().Stub(x => x.BuildPartial(theChain)).Return(theAction); theOutput = ClassUnderTest.InvokeObject(theInput); }
protected override void beforeEach() { theInput = new PartialInputModel(); theAction = MockFor <IActionBehavior>(); MockFor <IFubuRequest>().Stub(x => x.Get <PartialInputModel>()).Return(theInput); MockFor <IAuthorizationPreviewService>().Expect(x => x.IsAuthorized(theInput)).Return(true); MockFor <IPartialFactory>().Stub(x => x.BuildPartial(typeof(PartialInputModel))).Return(theAction); MockFor <IOutputWriter>() .Expect(x => x.Record(theAction.InvokePartial)) .WhenCalled(r => theAction.InvokePartial()) .Return(MockFor <IRecordedOutput>()); ClassUnderTest.Invoke <PartialInputModel>(); }
protected override void beforeEach() { theInput = new PartialInputModel(); theAction = MockFor <IActionBehavior>(); MockFor <IFubuRequest>().Stub(x => x.Get <PartialInputModel>()).Return(theInput); MockFor <IAuthorizationPreviewService>().Expect(x => x.IsAuthorized(theInput)).Return(false); theChain = new BehaviorChain(); MockFor <IChainResolver>().Stub(x => x.FindUnique(theInput)).Return(theChain); MockFor <IPartialFactory>().Stub(x => x.BuildPartial(theChain)).Return(theAction); Services.Inject <ITypeResolver>(new TypeResolver()); theOutput = ClassUnderTest.InvokeObject(theInput); }
protected override void beforeEach() { theInput = new PartialInputModel(); theChain = new BehaviorChain(); MockFor <IChainResolver>().Stub(x => x.FindUniqueByType(theInput.GetType(), Categories.VIEW)).Return(theChain); theAction = MockFor <IActionBehavior>(); MockFor <IAuthorizationPreviewService>().Expect(x => x.IsAuthorized(theInput)).Return(true); MockFor <IPartialFactory>().Stub(x => x.BuildPartial(theChain)).Return(theAction); MockFor <IRecordedOutput>().Stub(x => x.Headers()).Return(Enumerable.Empty <Header>()); MockFor <IOutputWriter>() .Expect(x => x.Record(theAction.InvokePartial)) .WhenCalled(r => theAction.InvokePartial()) .Return(MockFor <IRecordedOutput>()); Configure(); Invoke(); }
protected override void beforeEach() { theInput = new PartialInputModel(); theAction = MockFor <IActionBehavior>(); MockFor <IFubuRequest>().Stub(x => x.Get <PartialInputModel>()).Return(theInput); MockFor <IAuthorizationPreviewService>().Expect(x => x.IsAuthorized(theInput, "POST")).Return(true); theChain = new BehaviorChain(); MockFor <IChainResolver>().Stub(x => x.FindUniqueByType(typeof(PartialInputModel), category: "POST")).Return(theChain); MockFor <IPartialFactory>().Stub(x => x.BuildPartial(theChain)).Return(theAction); MockFor <IRecordedOutput>().Stub(x => x.Headers()).Return(Enumerable.Empty <Header>()); MockFor <IOutputWriter>() .Expect(x => x.Record(theAction.InvokePartial)) .WhenCalled(r => theAction.InvokePartial()) .Return(MockFor <IRecordedOutput>()); ClassUnderTest.Invoke <PartialInputModel>("POST"); }