示例#1
0
        public void GivenAOneStepWizard_OnMoveNext_WizardIsFinished()
        {
            var step = new WizardStep();
            var wizard = new Wizard()
                    .AddStep(step);

            wizard.Start();
            wizard.MoveNext();
            Assert.That(wizard.IsInProcess, Is.False);
        }
示例#2
0
        public void can_add_colection_of_args_to_a_step_in_constructor()
        {
            var args = new Args();
            args.AddOrReplace("arg1", "A");
            args.AddOrReplace("arg2", "B");

            var step = new WizardStep(args);

            Assert.AreEqual(args, step.Args);
        }
示例#3
0
        public void GivenAOneStepWizard_OnExit_WizardIsNotInProcess()
        {
            var step = new WizardStep();
            var wizard = new Wizard()
                    .AddStep(step);

            wizard.Start();
            wizard.Exit();
            Assert.That(wizard.IsInProcess, Is.False);
        }
示例#4
0
        public void can_not_move_next_on_an_unstarted_wizard()
        {
            var step1 = new WizardStep();

            _wizard = new Wizard()
                .AddStep(step1);

            _wizard.MoveNext();
            Assert.AreEqual(true, _wizard.IsInProcess);
            Assert.AreEqual(step1, _wizard.CurrentStep);
        }
示例#5
0
        public void can_add_individual_args_to_a_step()
        {
            var step = new WizardStep();

            step.Args.AddOrReplace("arg1", "A");
            step.Args.AddOrReplace("arg2", "B");

            Assert.AreEqual(2, step.Args.Count);
            Assert.AreEqual("A", step.Args["arg1"]);
            Assert.AreEqual("B", step.Args["arg2"]);
        }
        public void GiveAnUnstartedWizard_OnStarting_TheFirstStepIsSentToTheView()
        {
            var view = new MockViewFactory().AView.Mock();
            var controller = new WizardController(view.Object);

            var step = new WizardStep();
            var wizard = new Wizard()
                    .AddStep(step);

            controller.Start(wizard);
            view.Verify(m => m.ShowStep(step));
        }
        public void GivenAStartedWizard_OnFinish_NoStepIsSentToTheView()
        {
            var view = new MockViewFactory().AView.Mock();
            var controller = new WizardController(view.Object);

            var step = new WizardStep();
            var wizard = new Wizard()
                    .AddStep(step);

            controller.Start(wizard);
            view.Raise(v => v.MovedNext += null, EventArgs.Empty);
            view.Verify(m => m.ShowStep(step), Times.AtMostOnce());
        }
        public void GivenAStartedWizard_OnMoveNext_TheSecondStepIsSentToTheView()
        {
            var view = new MockViewFactory().AView.Mock();
            var controller = new WizardController(view.Object);

            var step1 = new WizardStep();
            var step2 = new WizardStep();
            var wizard = new Wizard()
                    .AddStep(step1)
                    .AddStep(step2);

            controller.Start(wizard);
            view.Raise(v => v.MovedNext += null, EventArgs.Empty);
            view.Verify(m => m.ShowStep(step2));
        }
示例#9
0
        public void GivenAOneStepWizard_OnStarting_WizardIsOnFirstStep()
        {
            var step = new WizardStep();
            var wizard = new Wizard()
                    .AddStep(step);

            wizard.Start();
            Assert.That(wizard.IsFirstStep());
        }
示例#10
0
        public void GivenAOneStepWizard_OnMovePrevious_WizardIsCancelled()
        {
            var step = new WizardStep();
            var wizard = new Wizard()
                    .AddStep(step);

            wizard.Start();
            wizard.MovePrevious();
            Assert.That(wizard.IsInProcess, Is.False);
        }
示例#11
0
        public void GivenATwoStepWizard_OnStarting_WizardIsNotOnLastStep()
        {
            var step1 = new WizardStep();
            var step2 = new WizardStep();
            var wizard = new Wizard()
                    .AddStep(step1)
                    .AddStep(step2);

            wizard.Start();
            Assert.That(wizard.IsLastStep(), Is.False);
        }
示例#12
0
        public void GivenATwoStepWizard_OnMovingToSecondStep_WizardIsNotOnFirstStep()
        {
            var step1 = new WizardStep();
            var step2 = new WizardStep();
            var wizard = new Wizard()
                    .AddStep(step1)
                    .AddStep(step2);

            wizard.Start();
            wizard.MoveNext();
            Assert.That(wizard.IsFirstStep(),Is.False);
        }
示例#13
0
 public void new_step_has_0_args()
 {
     var step = new WizardStep();
     Assert.AreEqual(0, step.Args.Count);
 }