public void on_sub_wizard_completion_previous_wizard_resumes()
        {
            var step1 = new MockStepFactory().AStep.ThatCanMoveNext.Stub();
            var step2 = new MockStepFactory().AStep.ThatCanMoveNext.Stub();
            var step3 = new MockStepFactory().AStep.Stub();
            var mainWizard = new Wizard()
                                    .AddStep(step1)
                                    .AddStep(step2)
                                    .AddStep(step3);

            var step1_1 = new MockStepFactory().AStep.ThatCanMoveNext.Stub();
            var subWizard = new Wizard()
                                    .AddStep(step1_1);

            var view = new MockViewFactory().AView.Mock();
            var controller = new WizardController(view.Object);

            controller.Start(mainWizard);
            view.Raise(v => v.MovedNext += null, EventArgs.Empty);
            Assert.AreEqual(step2, controller.CurrentStep, "At Step 2 before starting Sub Wizard");

            controller.Start(subWizard);
            Assert.AreEqual(step1_1, controller.CurrentStep, "In Sub Wizard after starting Sub Wizard");

            view.Raise(v => v.MovedNext += null, EventArgs.Empty);
            Assert.AreEqual(step2, controller.CurrentStep, "At Step 2 after ending Sub Wizard");
        }
        public void GiveAnUnstartedWizard_OnStarting_TheFirstStepIsSentToTheView()
        {
            var view = new MockViewFactory().AView.Mock();
            var controller = new WizardController(view.Object);

            var step = new WizardStep();
            var wizard = new Wizard()
                    .AddStep(step);

            controller.Start(wizard);
            view.Verify(m => m.ShowStep(step));
        }
        public void GivenAStartedWizard_OnFinish_NoStepIsSentToTheView()
        {
            var view = new MockViewFactory().AView.Mock();
            var controller = new WizardController(view.Object);

            var step = new WizardStep();
            var wizard = new Wizard()
                    .AddStep(step);

            controller.Start(wizard);
            view.Raise(v => v.MovedNext += null, EventArgs.Empty);
            view.Verify(m => m.ShowStep(step), Times.AtMostOnce());
        }
        public void GivenAStartedWizard_OnMoveNext_TheSecondStepIsSentToTheView()
        {
            var view = new MockViewFactory().AView.Mock();
            var controller = new WizardController(view.Object);

            var step1 = new WizardStep();
            var step2 = new WizardStep();
            var wizard = new Wizard()
                    .AddStep(step1)
                    .AddStep(step2);

            controller.Start(wizard);
            view.Raise(v => v.MovedNext += null, EventArgs.Empty);
            view.Verify(m => m.ShowStep(step2));
        }