Ejemplo n.º 1
0
        public void TestHeaderLabelDisabledWhen_WizardStepTextSetBackToNull()
        {
            // this test doesn't do what it says?!
            //---------------Set up test pack-------------------
            IWizardControllerSpy wizardController = CreateWizardControllerStub();
            IWizardControl       wizardControl    = GetControlFactory().CreateWizardControl(wizardController);

            SetWizardControlSize(wizardControl);
            wizardControl.Start();
            wizardControl.Next();
            //--------------Assert PreConditions----------------
            wizardController.GetCurrentStep();
            Assert.AreEqual("ControlForStep2", wizardControl.CurrentControl.Name);
            //Assert.IsTrue(wizardControl.HeadingLabel.Visible); //removed the label and am now putting the header on the form
            // due to problems with giz hiding the some wizard controls that where double clicked
            //Assert.IsTrue(wizardControl.HeadingLabel.Text.Length > 0);
            //Assert.AreEqual(step.HeaderText, wizardControl.HeadingLabel.Text);
            //Assert.AreEqual(wizardControl.Height - wizardControl.NextButton.Height - 62 - wizardControl.HeadingLabel.Height, wizardControl.WizardStepPanel.Height);

            //---------------Execute Test ----------------------
            wizardControl.Previous();
            //---------------Test Result -----------------------
            wizardController.GetCurrentStep();
            Assert.AreEqual("ControlForStep1", wizardControl.CurrentControl.Name);
            //Assert.IsFalse(wizardControl.HeadingLabel.Visible);
            //Assert.IsFalse(wizardControl.HeadingLabel.Text.Length > 0);
            //Assert.AreEqual(step.HeaderText, wizardControl.HeadingLabel.Text);
            //Assert.AreEqual(wizardControl.Height - wizardControl.NextButton.Height - 62, wizardControl.WizardStepPanel.Height);
        }
Ejemplo n.º 2
0
        public void Test_PreviousButtonDisabledIfCanMoveBackFalse_FromPreviousTep()
        {
            //TODO: setup with 3 steps set step 2 allow move back false
            //and go next next next previous and then ensure that canMoveBack false
            //---------------Set up test pack-------------------
            IWizardControllerSpy wizardController = CreateWizardControllerStub();

            wizardController.ForTestingAddWizardStep(CreateWizardStepStub());

            IWizardControl wizardControl = GetControlFactory().CreateWizardControl(wizardController);

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

            //---------------Assert Preconditions ----------------------
            Assert.IsFalse(wizardController.ControlForStep2.CanMoveBack());
            //---------------Execute Test ----------------------
            wizardControl.Next();
            wizardControl.Next();
            wizardControl.Previous();
            //---------------Assert result -----------------------
            Assert.AreSame(wizardControl.CurrentControl, wizardController.ControlForStep2);
            Assert.IsFalse(((IWizardStepStub)wizardControl.CurrentControl).AllowMoveBack);
            Assert.IsFalse(wizardControl.PreviousButton.Enabled);
        }
Ejemplo n.º 3
0
        public void TestHeaderLabelEnabledWhen_WizardStepTextSet()
        {
            //---------------Set up test pack-------------------
            IWizardControllerSpy wizardController = CreateWizardControllerStub();
            IWizardControl       wizardControl    = GetControlFactory().CreateWizardControl(wizardController);

            SetWizardControlSize(wizardControl);
            wizardControl.Start();
            //--------------Assert PreConditions----------------
            Assert.AreEqual("ControlForStep1", wizardControl.CurrentControl.Name);
            //Assert.IsFalse(wizardControl.HeadingLabel.Visible);
            //Assert.AreEqual(wizardControl.Height - wizardControl.NextButton.Height - 62, wizardControl.WizardStepPanel.Height);
            //---------------Execute Test ----------------------
            wizardControl.Next();
            //---------------Test Result -----------------------
            IWizardStep currentStep = wizardController.GetCurrentStep();

            Assert.AreEqual("ControlForStep2", wizardControl.CurrentControl.Name);
            Assert.AreSame(currentStep, wizardControl.CurrentControl);
            Assert.IsTrue(((IWizardStepStub)currentStep).IsInitialised);
            //Assert.IsTrue(wizardControl.HeadingLabel.Visible);
            //Assert.IsTrue(wizardControl.HeadingLabel.Text.Length > 0);
            //Assert.AreEqual(step.HeaderText, wizardControl.HeadingLabel.Text);
            //Assert.AreEqual(wizardControl.Height - wizardControl.NextButton.Height - 62 - wizardControl.HeadingLabel.Height, wizardControl.WizardStepPanel.Height);
        }
Ejemplo n.º 4
0
        public void TestStart()
        {
            //Setup -----------------------------------------------------
            IWizardControllerSpy wizardController = CreateWizardControllerStub();
            IWizardControl       wizardControl    = GetControlFactory().CreateWizardControl(wizardController);

            //Execute ---------------------------------------------------
            wizardControl.Start();
            //Assert Results --------------------------------------------
            Assert.AreEqual("ControlForStep1", wizardControl.CurrentControl.Name);
            Assert.AreEqual(wizardController.ControlForStep1.Name, wizardControl.CurrentControl.Name);
        }
Ejemplo n.º 5
0
        public void Test_CancelButton_WhenCanCancelTrue_ShouldBeEnabled()
        {
            //---------------Set up test pack-------------------
            IWizardControllerSpy wizardController = CreateWizardControllerStub();
            IWizardControl       wizardControl    = GetControlFactory().CreateWizardControl(wizardController);

            wizardController.AllowCancel = true;
            wizardControl.Start();
            //---------------Assert Preconditions ----------------------
            Assert.IsTrue(wizardController.CanCancel());
            //---------------Execute Test ----------------------
            var cancelEnabled = wizardControl.CancelButton.Enabled;

            //---------------Assert result -----------------------
            Assert.IsTrue(cancelEnabled, "Cancel should b enabled");
        }
Ejemplo n.º 6
0
        public void Test_FinishButton_WhenAtLastStep_ShouldBeEnabled()
        {
            //---------------Set up test pack-------------------
            IWizardControllerSpy wizardController = CreateWizardControllerStub();
            IWizardControl       wizardControl    = GetControlFactory().CreateWizardControl(wizardController);

            wizardController.ControlForStep3.AllowFinish = true;
            wizardControl.Start();
            wizardControl.Next();
            wizardControl.Next();
            //---------------Assert Preconditions ----------------------
            Assert.IsTrue(wizardController.IsLastStep());
            //---------------Execute Test ----------------------
            wizardControl.Finish();
            //---------------Test Result -----------------------
            Assert.IsTrue(wizardControl.FinishButton.Enabled);
        }
Ejemplo n.º 7
0
        public void Test_FinishButton_WhenCanFinishTrue_ShouldBeEnabled()
        {
            //---------------Set up test pack-------------------
            IWizardControllerSpy wizardController = CreateWizardControllerStub();
            IWizardControl       wizardControl    = GetControlFactory().CreateWizardControl(wizardController);

            wizardController.ControlForStep2.AllowFinish = true;
            wizardControl.Start();
            //---------------Assert Preconditions ----------------------
            Assert.IsTrue(wizardController.ControlForStep2.AllowFinish);
            Assert.IsTrue(wizardController.ControlForStep2.CanFinish());
            //---------------Execute Test ----------------------
            wizardControl.Next();
            //---------------Assert result -----------------------
            Assert.AreSame(wizardControl.CurrentControl, wizardController.ControlForStep2);
            Assert.IsTrue(wizardControl.FinishButton.Enabled, "Finish button should be enabled");
        }
Ejemplo n.º 8
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);
        }
Ejemplo n.º 9
0
        public void Test_NextClickAtLastStep_WhenCanMoveOnfalse_DoesNotFinish()
        {
            //---------------Set up test pack-------------------
            IWizardControllerSpy controller    = CreateWizardControllerStub();
            IWizardControl       wizardControl = GetControlFactory().CreateWizardControl(controller);// new WizardControl(_controller);

            controller.ControlForStep1.AllowMoveOn = true;
            controller.ControlForStep2.AllowMoveOn = false;

            wizardControl.Start();
            wizardControl.NextButton.PerformClick();
            //---------------Execute Test ----------------------
            wizardControl.NextButton.PerformClick();
            //---------------Test Result -----------------------
            // Finish should not have been called because CanMoveOn on step two is returning false and should prevent
            // the wizard from finishing.
            Assert.IsFalse(controller.FinishWizardWasCalled);
        }
Ejemplo n.º 10
0
        public void TestFinishButton_WhenClicked_WhenCanMoveOn_ShouldFireFinishEvent()
        {
            //---------------Set up test pack-------------------
            IWizardControllerSpy wizardController = CreateWizardControllerStub();
            IWizardControl       wizardControl    = GetControlFactory().CreateWizardControl(wizardController);

            wizardController.AllowCanMoveOn = true;
            wizardControl.Start();
            //--------------Assert PreConditions----------------
            Assert.IsFalse(wizardController.FinishWizardWasCalled);
            string message;

            Assert.IsTrue(wizardController.CanMoveOn(out message));
            //---------------Execute Test ----------------------
            wizardControl.Finish();
            //---------------Test Result -----------------------
            Assert.IsTrue(wizardController.FinishWizardWasCalled, "Finish should be called");
        }
Ejemplo n.º 11
0
        public void Test_NextButton_WhenAtLastStep_ShouldBeDisabled()
        {
            //---------------Set up test pack-------------------
            IWizardControllerSpy wizardController = CreateWizardControllerStub();
            IWizardControl       wizardControl    = GetControlFactory().CreateWizardControl(wizardController);

            wizardController.ControlForStep3.AllowFinish = true;
            wizardControl.Start();
            wizardControl.Next();
            //---------------Assert Preconditions ----------------------
            Assert.IsFalse(wizardController.IsLastStep(), "Should not be last step");
            Assert.IsTrue(wizardControl.NextButton.Enabled, "If this is not the last step should be enabled");
            //---------------Execute Test ----------------------
            wizardControl.Next();
            //---------------Test Result -----------------------
            Assert.IsTrue(wizardController.IsLastStep(), "Should be last step");
            Assert.IsFalse(wizardControl.NextButton.Enabled, "Should disable next button and enable Finish button at last step");
            Assert.IsTrue(wizardControl.FinishButton.Enabled, "Should enable Finish button at last step");
        }
Ejemplo n.º 12
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);
        }
Ejemplo n.º 13
0
        public void TestFinish_WhenNotCanMoveOn_ShouldNotFireFinishEventAndShouldPostMessage()
        {
            //---------------Set up test pack-------------------
            IWizardControllerSpy wizardController = CreateWizardControllerStub();
            IWizardControl       wizardControl    = GetControlFactory().CreateWizardControl(wizardController);
            string message;

            wizardController.AllowCanMoveOn = false;
            wizardControl.Start();
            //--------------Assert PreConditions----------------
            Assert.IsFalse(wizardController.FinishWizardWasCalled);
            Assert.IsFalse(wizardController.CanMoveOn(out message));
            message = "";
            //---------------Execute Test ----------------------
            wizardControl.MessagePosted += delegate(string messagePosted) { message = messagePosted; };
            wizardControl.Finish();
            //---------------Test Result -----------------------
            Assert.IsFalse(wizardController.FinishWizardWasCalled, "Finish should be called");
            Assert.AreEqual("AllowCanMoveOnFalse", message);
        }
Ejemplo n.º 14
0
        public void Test_FinishButton_WhenCanFinishFalse_WhenFromPreviousStep_ShouldBeDisabled()
        {
            //---------------Set up test pack-------------------
            IWizardControllerSpy wizardController = CreateWizardControllerStub();

            wizardController.ForTestingAddWizardStep(CreateWizardStepStub());
            IWizardControl wizardControl = GetControlFactory().CreateWizardControl(wizardController);

            wizardController.ControlForStep2.AllowFinish = false;
            wizardControl.Start();
            //---------------Assert Preconditions ----------------------
            Assert.IsFalse(wizardController.ControlForStep2.AllowFinish);
            Assert.IsFalse(wizardController.ControlForStep2.CanFinish());
            //---------------Execute Test ----------------------
            wizardControl.Next();
            wizardControl.Next();
            wizardControl.Previous();
            //---------------Assert result -----------------------
            Assert.AreSame(wizardControl.CurrentControl, wizardController.ControlForStep2);
            Assert.IsFalse(wizardControl.FinishButton.Enabled);
        }
Ejemplo n.º 15
0
 public void SetupTest()
 {
     _controller.ControlForStep1.AllowMoveOn = true;
     _message = "";
     _wizardControl.Start();
 }