Ejemplo n.º 1
0
        public void Test_WizardControllerCancelsWizardSteps()
        {
            //---------------Set up test pack-------------------
            WizardController wizardController = new WizardController();
            IWizardStep      wzrdStep         = MockRepository.GenerateMock <IWizardStep>();
            IWizardControl   wizardControl    = GetControlFactory().CreateWizardControl(wizardController);

            wizardController.AddStep(wzrdStep);
            //--------------Assert PreConditions----------------
            wzrdStep.AssertWasNotCalled(step => step.CancelStep());
            //---------------Execute Test ----------------------
            wizardControl.CancelButton.PerformClick();
            //---------------Test Result -----------------------
            wzrdStep.AssertWasCalled(step => step.CancelStep());
        }
Ejemplo n.º 2
0
        public void Test_Finish_ShouldCallCurrentStepMoveOn()
        {
            //-----------------------Setup TestPack----------------------
            WizardController wizardController = new WizardController();

            IWizardStep step1 = MockRepository.GenerateMock <IWizardStep>();

            wizardController.AddStep(step1);

            wizardController.GetFirstStep();
            //------------------------Assert Precondition----------------
            Assert.AreSame(step1, wizardController.GetCurrentStep());
            step1.AssertWasNotCalled(step => step.MoveOn());
            //------------------------Execute----------------------------
            wizardController.Finish();
            //------------------------Verify Result ---------------------
            step1.AssertWasCalled(step => step.MoveOn());
        }
Ejemplo n.º 3
0
        public void Test_Finish_WhenNotLast_ShouldCallCurrentStepMoveOn()
        {
            //-----------------------Setup TestPack----------------------
            WizardController wizardController = new WizardController();

            IWizardStep step1 = MockRepository.GenerateMock <IWizardStep>();

            step1.Stub(wizardStep => wizardStep.CanFinish()).Return(true);
            wizardController.AddStep(step1);
            wizardController.AddStep(step1);

            wizardController.GetFirstStep();
            //------------------------Assert Precondition----------------
            Assert.AreSame(step1, wizardController.GetCurrentStep());
            Assert.IsFalse(wizardController.IsLastStep());
            Assert.IsTrue(wizardController.CanFinish(), "Should be able to finish this");
            step1.AssertWasNotCalled(step => step.MoveOn());
            //------------------------Execute----------------------------
            wizardController.Finish();
            //------------------------Verify Result ---------------------
            step1.AssertWasCalled(step => step.MoveOn());//Should now be able to call finish even when not last step
        }