コード例 #1
0
        public void Test_Next_ShouldCallWizardControllerNext()
        {
            //---------------Set up test pack-------------------
            IWizardController controller    = MockRepository.GenerateMock <IWizardController>();
            IWizardControl    wizardControl = GetControlFactory().CreateWizardControl(controller);
            string            message;

            controller.Stub(wizardController => wizardController.CanMoveOn(out message)).Return(true);
            controller.Stub(controller1 => controller1.GetNextStep()).Return(CreateWizardStepStub());
            //---------------Assert Precondition----------------
            Assert.IsTrue(controller.CanMoveOn(out message));
            controller.AssertWasNotCalled(cntrler => cntrler.CompleteCurrentStep());
            //---------------Execute Test ----------------------
            wizardControl.Next();
            //---------------Test Result -----------------------
            controller.AssertWasCalled(cntrler => cntrler.CompleteCurrentStep());
        }
コード例 #2
0
        public void Test_PreviousButtonDisabledIfCanMoveBackFalse()
        {
            //---------------Set up test pack-------------------
            IWizardControllerSpy wizardController = CreateWizardControllerStub();
            IWizardControl       wizardControl    = GetControlFactory().CreateWizardControl(wizardController);

            wizardController.ControlForStep2.AllowMoveBack = false;
            wizardControl.Start();

            //---------------Assert Preconditions ----------------------
            Assert.IsFalse(wizardController.ControlForStep2.CanMoveBack());
            //---------------Execute Test ----------------------
            wizardControl.Next();
            //---------------Assert result -----------------------
            Assert.AreSame(wizardControl.CurrentControl, wizardController.ControlForStep2);
            Assert.IsFalse(((IWizardStepStub)wizardControl.CurrentControl).AllowMoveBack);
            Assert.IsFalse(wizardControl.PreviousButton.Enabled);
        }
コード例 #3
0
        public void Test_Next_ShouldCallMoveNext()
        {
            //---------------Set up test pack-------------------
            IWizardControllerSpy controller = CreateWizardControllerStub();
            var step1 = controller.ControlForStep1;

            step1.AllowMoveOn = true;
            IWizardControl wizardControl = GetControlFactory().CreateWizardControl(controller);

            controller.GetFirstStep();
            //---------------Assert Precondition----------------
            Assert.AreEqual(3, controller.StepCount);
            Assert.IsFalse(step1.MoveOnWasCalled);
            Assert.AreSame(step1, controller.GetCurrentStep());
            //---------------Execute Test ----------------------
            wizardControl.Next();
            //---------------Test Result -----------------------
            Assert.IsTrue(step1.MoveOnWasCalled);
        }
コード例 #4
0
        public void Test_FinishButton_WhenCanFinishFalse_ShouldBeDisabled()
        {
            //---------------Set up test pack-------------------
            IWizardControllerSpy wizardController = CreateWizardControllerStub();
            IWizardControl       wizardControl    = GetControlFactory().CreateWizardControl(wizardController);

            wizardController.ControlForStep2.AllowFinish = false;
            wizardControl.Start();

            //---------------Assert Preconditions ----------------------
            Assert.IsFalse(wizardController.ControlForStep1.AllowFinish);
            Assert.IsFalse(wizardController.ControlForStep1.CanFinish());
            //---------------Execute Test ----------------------
            wizardControl.Next();
            //---------------Assert result -----------------------
            Assert.AreSame(wizardControl.CurrentControl, wizardController.ControlForStep2);
            Assert.IsFalse(wizardController.IsLastStep());
            Assert.IsFalse(wizardControl.FinishButton.Enabled, "Finish button should be disabled");
        }
コード例 #5
0
        public void Test_SetStepResizesControl()
        {
            //---------------Set up test pack-------------------
            IWizardControllerSpy wizardController = CreateWizardControllerStub();
            IWizardControl       wizardControl    = GetControlFactory().CreateWizardControl(wizardController);

            wizardControl.Start();
            wizardController.ControlForStep2.Width = 10;

            //--------------Assert PreConditions----------------
            string msg;

            Assert.IsTrue(wizardController.CanMoveOn(out msg));

            //---------------Execute Test ----------------------
            wizardControl.Next();

            //---------------Test Result -----------------------
            Assert.AreEqual(wizardControl.Width - WizardControl.PADDING * 2, wizardController.ControlForStep2.Width);
        }
コード例 #6
0
 private void MoveToLastStep(IWizardControl wizardControl)
 {
     wizardControl.Next();
     wizardControl.Next();
 }
コード例 #7
0
 public void Test_Next_ShouldSetStep2()
 {
     //Execute ---------------------------------------------------
     _wizardControl.Next();
     //Assert Results --------------------------------------------
     Assert.AreSame(_controller.ControlForStep2, _wizardControl.CurrentControl);
 }
コード例 #8
0
 private void MoveToLastStep(IWizardControl wizardControl)
 {
     wizardControl.Next();
     wizardControl.Next();
 }