public void Test_Previous_ShouldCallUndoMoveOnForPreviousStep() { //---------------Set up test pack------------------- WizardController controller = new WizardController(); IWizardControl wizardControl = GetControlFactory().CreateWizardControl(controller); var step1 = CreateWizardStepStub(); controller.AddStep(step1); var step2 = CreateWizardStepStub(); controller.AddStep(step2); step1.AllowMoveOn = true; step2.AllowMoveBack = true; controller.GetFirstStep(); controller.GetNextStep(); //---------------Assert Precondition---------------- Assert.IsTrue(controller.CanMoveBack()); Assert.AreSame(step2, controller.GetCurrentStep()); Assert.IsFalse(step1.UndoMoveOnWasCalled); Assert.IsFalse(step2.UndoMoveOnWasCalled); //---------------Execute Test ---------------------- wizardControl.Previous(); //---------------Test Result ----------------------- Assert.AreSame(step1, controller.GetCurrentStep()); Assert.IsTrue(step1.UndoMoveOnWasCalled); Assert.IsFalse(step2.UndoMoveOnWasCalled); }
public void TestFinish_FiresEvent() { //-----------------------Setup TestPack---------------------- WizardController wizardController = new WizardController(); bool wizardFinishedFires = false; wizardController.WizardFinished += delegate { wizardFinishedFires = true; }; IWizardStep step1 = _mock.StrictMock<IWizardStep>(); wizardController.AddStep(step1); wizardController.GetNextStep(); //------------------------Execute---------------------------- wizardController.Finish(); //------------------------Verify Result --------------------- Assert.IsTrue(wizardFinishedFires); }