Habanero.Faces.Base.WizardController.GetFirstStep C# (CSharp) Method

GetFirstStep() public method

Returns the First Step of the Wizard and sets the current step to that step.
public GetFirstStep ( ) : IWizardStep
return IWizardStep
        public virtual IWizardStep GetFirstStep()
        {
            if (StepCount <= 0)
            {
                throw new HabaneroApplicationException(
                    "There was an Error when trying to access the first step of the wizard Controller" 
                    + this.GetType() + ". The wizard controller has not been set up with steps");
            }
            CurrentStep = 0;
            _visitedSteps.Clear();
            var currentStep = GetCurrentStep();
            if (currentStep != null) _visitedSteps.Push(currentStep);
            return currentStep;
        }

Usage Example

 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);
 }
All Usage Examples Of Habanero.Faces.Base.WizardController::GetFirstStep