示例#1
0
        public void ExecuteSubFunction_ReEntrancy_GoesToPostProcessingSubFunction()
        {
            using (MockRepository.Ordered())
            {
                SubFunction.Expect(mock => mock.Execute(WxeContext)).WhenCalled(invocation => Thread.CurrentThread.Abort());
                SubFunction.Expect(mock => mock.Execute(WxeContext));
                ExecutionStateContextMock.Expect(mock => mock.SetExecutionState(Arg <IExecutionState> .Is.NotNull));
            }

            MockRepository.ReplayAll();

            try
            {
                _executionState.ExecuteSubFunction(WxeContext);
                Assert.Fail();
            }
            catch (ThreadAbortException)
            {
                Thread.ResetAbort();
            }

            _executionState.ExecuteSubFunction(WxeContext);

            MockRepository.VerifyAll();
        }
示例#2
0
        public void ExecuteSubFunction_GoesToPostProcessingSubFunction()
        {
            using (MockRepository.Ordered())
            {
                SubFunction.Expect(mock => mock.Execute(WxeContext));
                ExecutionStateContextMock.Expect(mock => mock.SetExecutionState(Arg <PostProcessingSubFunctionState> .Is.NotNull))
                .WhenCalled(invocation => CheckExecutionState((PostProcessingSubFunctionState)invocation.Arguments[0]));
            }

            MockRepository.ReplayAll();

            _executionState.ExecuteSubFunction(WxeContext);

            MockRepository.VerifyAll();
        }
示例#3
0
        public void ExecuteSubFunction_GoesToReturningFromSubFunction()
        {
            using (MockRepository.Ordered())
            {
                SubFunction.Expect(mock => mock.Execute(WxeContext));
                ExecutionStateContextMock.Expect(
                    mock => mock.SetExecutionState(Arg <IExecutionState> .Is.NotNull))
                .WhenCalled(
                    invocation =>
                {
                    Assert.That(invocation.Arguments[0], Is.InstanceOf(typeof(ReturningFromSubFunctionState)));
                    var nextState = (ReturningFromSubFunctionState)invocation.Arguments[0];
                    Assert.That(nextState.ExecutionStateContext, Is.SameAs(ExecutionStateContextMock));
                    Assert.That(nextState.Parameters.SubFunction, Is.SameAs(SubFunction));
                    Assert.That(nextState.Parameters.ResumeUrl, Is.EqualTo("/resumeUrl.wxe"));
                });
            }

            MockRepository.ReplayAll();

            _executionState.ExecuteSubFunction(WxeContext);

            MockRepository.VerifyAll();
        }