public void ShouldTryToMoveToSecondPageButPostValidationFails() { Given(); var wizardViewModel = new WizardViewModel(m_View, m_FirstPage, null, null); m_FirstPage.PostValidation = false; When(); wizardViewModel.MoveToNextPage(); Then(); Assert.That(m_View.PageControl, Is.EqualTo(m_FirstPageControl)); }
public void WhenOnFinalPageAndFirstPageChangesThenFinishButtonShouldNotChange() { Given(); var wizardViewModel = new WizardViewModel(m_View, m_FirstPage, null, null); m_LastPage.ReadyToMove(false); wizardViewModel.MoveToNextPage(); Assert.That(m_View.NextButton, Is.False); When(); m_FirstPage.ReadyToMove(true); m_FirstPage.RaiseOnChangeDoAction(); Then(); Assert.That(m_View.NextButton, Is.False); }
public void ShouldNotAllowMovingIfNotReadyToProceed() { Given(); var wizardViewModel = new WizardViewModel(m_View, m_FirstPage, null, null); m_FirstPage.ReadyToMove(false); When(); try { wizardViewModel.MoveToNextPage(); Assert.Fail("Should not get here"); } catch (NotReadyToProceedException e) { Then(); } }
public void ShouldRegisterListenersOnWizardControl() { Given(); DowntoolsSvrExperiment.Utilities.Action cancelAction = () => { }; When(); var wizardViewModel = new WizardViewModel(m_View, m_FirstPage, null, cancelAction); Then(); Assert.That(m_View.CancelButtonAction, Is.EqualTo(cancelAction)); Assert.That(m_View.NextButtonAction, Is.EqualTo(new DowntoolsSvrExperiment.Utilities.Action(wizardViewModel.MoveToNextPage))); Assert.That(m_View.PreviousButtonAction, Is.EqualTo(new DowntoolsSvrExperiment.Utilities.Action(wizardViewModel.MoveToPreviousPage))); }
public void ShouldMoveToSecondPageAndSetFinishButtonToDisabledWhenNotReadyToProceed() { Given(); var wizardViewModel = new WizardViewModel(m_View, m_FirstPage, null, null); m_LastPage.ReadyToMove(false); When(); wizardViewModel.MoveToNextPage(); Then(); Assert.That(m_View.NextButton, Is.False); Assert.That(m_View.NextButtonName, Is.EqualTo("Finish")); }
public void ShouldNotAllowMovingBeforeFirstPage() { Given(); var wizardViewModel = new WizardViewModel(m_View, m_FirstPage, null, null); When(); try { wizardViewModel.MoveToPreviousPage(); Assert.Fail("Should not get here"); } catch(MoveBeforeFirstPageException e) { Then(); } }
public void ShouldMoveToSecondPageAndSetControl() { Given(); var wizardViewModel = new WizardViewModel(m_View, m_FirstPage, null, null); When(); wizardViewModel.MoveToNextPage(); Then(); Assert.That(m_View.PageControl, Is.EqualTo(m_LastPageControl)); Assert.That(m_View.PageName, Is.EqualTo("Step 2 of 2: Last Page")); }
public void ShouldMoveToSecondPageAndSetBackToEnabledAndNextButtonToFinishedWhenReadyToProceed() { Given(); var wizardViewModel = new WizardViewModel(m_View, m_FirstPage, null, null); m_LastPage.ReadyToMove(true); When(); wizardViewModel.MoveToNextPage(); Then(); Assert.That(m_View.PageControl, Is.EqualTo(m_LastPageControl)); Assert.That(m_View.BackButton, Is.True); Assert.That(m_View.NextButton, Is.True); Assert.That(m_View.NextButtonName, Is.EqualTo("Finish")); Assert.That(m_View.CancelButton, Is.True); }
public void ShouldMoveBackFromSecondToFirstPage() { Given(); var wizardViewModel = new WizardViewModel(m_View, m_FirstPage, null, null); When(); wizardViewModel.MoveToNextPage(); wizardViewModel.MoveToPreviousPage(); Then(); Assert.That(m_View.PageControl, Is.EqualTo(m_FirstPageControl)); Assert.That(m_View.BackButton, Is.False); Assert.That(m_View.NextButton, Is.True); Assert.That(m_View.NextButtonName, Is.EqualTo("Next")); Assert.That(m_View.CancelButton, Is.True); }
public void ShouldInformClientWhenFinished() { Given(); Boolean clientWasCalled = false; var wizardViewModel = new WizardViewModel(m_View, m_FirstPage, () => { clientWasCalled = true; }, null); When(); wizardViewModel.MoveToNextPage(); wizardViewModel.MoveToNextPage(); Then(); Assert.That(clientWasCalled, Is.True); }
public void ShouldHighlightSecondPageInListAfterMoving() { Given(); When(); var wizardViewModel = new WizardViewModel(m_View, m_FirstPage, null, null); wizardViewModel.MoveToNextPage(); Then(); Assert.That(m_View.PageList[0].CurrentPage, Is.False); Assert.That(m_View.PageList[1].CurrentPage, Is.True); }