Example #1
0
        private void button2_click(object sender, EventArgs e)
        {
            var subWizard = new Wizard("RightList");
            subWizard.AddStep(new SubStep1_1());

            ParentWizard.StartSubWizard(subWizard);
        }
        public void on_sub_wizard_completion_previous_wizard_resumes()
        {
            var step1 = new MockStepFactory().AStep.ThatCanMoveNext.Stub();
            var step2 = new MockStepFactory().AStep.ThatCanMoveNext.Stub();
            var step3 = new MockStepFactory().AStep.Stub();
            var mainWizard = new Wizard()
                                    .AddStep(step1)
                                    .AddStep(step2)
                                    .AddStep(step3);

            var step1_1 = new MockStepFactory().AStep.ThatCanMoveNext.Stub();
            var subWizard = new Wizard()
                                    .AddStep(step1_1);

            var view = new MockViewFactory().AView.Mock();
            var controller = new WizardController(view.Object);

            controller.Start(mainWizard);
            view.Raise(v => v.MovedNext += null, EventArgs.Empty);
            Assert.AreEqual(step2, controller.CurrentStep, "At Step 2 before starting Sub Wizard");

            controller.Start(subWizard);
            Assert.AreEqual(step1_1, controller.CurrentStep, "In Sub Wizard after starting Sub Wizard");

            view.Raise(v => v.MovedNext += null, EventArgs.Empty);
            Assert.AreEqual(step2, controller.CurrentStep, "At Step 2 after ending Sub Wizard");
        }
Example #3
0
        private void btnAdd_Click(object sender, System.EventArgs e)
        {
            var createCourse = new Wizard()
                .AddStep(new CreateCourse());

            StartSubWizard(createCourse);
        }
Example #4
0
        private void button1_click(object sender, EventArgs e)
        {
            var subWizard = new Wizard("SubWizard");
                subWizard.AddStep(new SubStep1_1());

            StartSubWizard(subWizard);
        }
Example #5
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);
        }
Example #6
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);
        }
        public void Start(Wizard wizard)
        {
            if (_activeWizard != null)
                _wizardStack.Push(_activeWizard);

            _activeWizard = wizard;
            _activeWizard.StartWith(this);

            ShowWizard(_view);
        }
Example #8
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);
        }
Example #9
0
        public Form1()
        {
            InitializeComponent();

            var wizard = new Wizard();
            wizard.AddStep(new Step1())
                  .AddStep(new Step2());

            var controller = new WizardController(wizardView);
            controller.Start(wizard);
        }
        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());
        }
        private void OnCancel(object sender, EventArgs e)
        {
            var view = sender as IWizardView;
            if (view == null) return;

            _activeWizard.Exit();
            if (_wizardStack.Count > 0)
            {
                _activeWizard = _wizardStack.Pop();
                ShowWizard(view);
            }
            else
                view.Unload(_activeWizard.Args);
        }
        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));
        }
Example #14
0
        static void Main()
        {
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);

            var argsForStep2 = new Args();
            argsForStep2.AddOrReplace("arg1", "abcdef");
            argsForStep2.AddOrReplace("arg2", "bcdef");
            argsForStep2.AddOrReplace("arg3", "cdef");
            argsForStep2.AddOrReplace("arg4", "efghi");
            argsForStep2.AddOrReplace("arg5", "fghijkl");

            IWizardView view = new SimpleWizardView();
            var controller = new WizardController(view);

            var wizard = new Wizard();
            wizard.AddStep(new Step1(argsForStep2))
                  .AddStep(new Step2(argsForStep2));
            controller.Start(wizard);

            Application.Run(view as Form);
        }
        private void OnMovedNext(object sender, EventArgs e)
        {
            var view = sender as IWizardView;
            if (view == null) return;

            _activeWizard.MoveNext();

            if (!_activeWizard.IsInProcess)
            {
                var resumeFromTitle = _activeWizard.Title;
                var returnArgs = _activeWizard.Args;

                if (_wizardStack.Count > 0)
                {
                    _activeWizard = _wizardStack.Pop();
                    CurrentStep.ResumeFrom(resumeFromTitle, returnArgs);
                }
                else
                    view.Unload(_activeWizard.Args);
            }

            if (_activeWizard.IsInProcess)
                ShowWizard(view);
        }
Example #16
0
 public void empty_wizard_throws_an_exception_on_start()
 {
     _wizard = new Wizard();
     _wizard.Start();
     _wizard.MoveNext();
 }
Example #17
0
 public void StartSubWizard(Wizard subWizard)
 {
     _controller.Start(subWizard);
 }
Example #18
0
 public void StartSubWizard(Wizard subWizard)
 {
     ParentWizard.StartSubWizard(subWizard);
 }
Example #19
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);
        }
Example #20
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);
        }
Example #21
0
 public void new_wizard_is_not_started()
 {
     _wizard = new Wizard();
     Assert.AreEqual(false, _wizard.IsInProcess);
 }
Example #22
0
 public void move_previous_unstarted_wizard_throws_exception()
 {
     _wizard = new Wizard();
     _wizard.AddStep(new WizardStep());
     _wizard.MovePrevious();
 }
Example #23
0
        public void GivenAOneStepWizard_OnStarting_WizardIsOnFirstStep()
        {
            var step = new WizardStep();
            var wizard = new Wizard()
                    .AddStep(step);

            wizard.Start();
            Assert.That(wizard.IsFirstStep());
        }
Example #24
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);
        }
Example #25
0
 public void a_wizard_can_have_a_title()
 {
     _wizard = new Wizard("Any Title");
     Assert.AreEqual("Any Title", _wizard.Title);
 }
Example #26
0
 public void a_wizard_does_not_have_to_have_a_title()
 {
     _wizard = new Wizard();
     Assert.AreEqual("", _wizard.Title);
 }
Example #27
0
 public void empty_wizard_throws_exception_on_move_next()
 {
     _wizard = new Wizard();
     _wizard.MoveNext();
 }