コード例 #1
0
        public void buttonCancel_Click_ShouldCallCloseOnActiveForm()
        {
            MockRepository mock = new MockRepository();

            Wizard             wizard      = new Wizard();
            IWizardFormFactory formFactory = mock.StrictMock <IWizardFormFactory>();
            WizardForm         mockForm    = mock.DynamicMock <WizardForm>();

            DummyPage page = new DummyPage();

            wizard.Pages.AddFirst(page);

            wizard.WizardFormFactory = formFactory;
            SetUpCommonExpectationsOnFormFactory(formFactory, mockForm);
            SetUpCommonExpectationsOnForm(mockForm);

            Expect.Call(mockForm.Close);

            mock.ReplayAll();

            wizard.StartWizard(null);

            Button    button = new Button();
            EventArgs e      = new EventArgs();

            wizard.buttonCancel_Click(button, e);

            mock.VerifyAll();
        }
コード例 #2
0
ファイル: Wizard.cs プロジェクト: pipipierre/Notpod
        /// <summary>
        /// Start the wizard by displaying the first page.
        /// </summary>
        /// <param name="owner"></param>
        public DialogResult StartWizard(IWin32Window owner)
        {
            ValidatePages();

            activeForm = wizardFormFactory.NewForm();
            activeForm.CancelButtonObject.Click += new EventHandler(buttonCancel_Click);
            activeForm.BackButton.Click         += new EventHandler(buttonBack_Click);
            activeForm.NextButton.Click         += new EventHandler(buttonNext_Click);
            activeForm.FinishButton.Click       += new EventHandler(buttonFinish_Click);

            currentPage = -1;
            NextPage();

            DialogResult formResult = DialogResult.None;

            if (owner == null)
            {
                formResult = activeForm.ShowDialog();
            }
            else
            {
                formResult = activeForm.ShowDialog(owner);
            }

            return(formResult);
        }
コード例 #3
0
 private void SetUpCommonExpectationsOnForm(WizardForm mockForm)
 {
     Expect.Call(mockForm.ShowDialog()).Return(DialogResult.OK);
     Expect.Call(mockForm.CancelButtonObject).Return(new Button());
     Expect.Call(mockForm.BackButton).Repeat.Any().Return(new Button());
     Expect.Call(mockForm.NextButton).Repeat.Any().Return(new Button());
     Expect.Call(mockForm.FinishButton).Repeat.Any().Return(new Button());
     Expect.Call(mockForm.LabelPageTitle).Return(new Label());
     Expect.Call(mockForm.PageContainer).Repeat.Any().Return(new Panel());
 }
コード例 #4
0
ファイル: WizardTest.cs プロジェクト: notpod/Notpod
 private void SetUpCommonExpectationsOnForm(WizardForm mockForm)
 {
     Expect.Call(mockForm.ShowDialog()).Return(DialogResult.OK);
     Expect.Call(mockForm.CancelButtonObject).Return(new Button());
     Expect.Call(mockForm.BackButton).Repeat.Any().Return(new Button());
     Expect.Call(mockForm.NextButton).Repeat.Any().Return(new Button());
     Expect.Call(mockForm.FinishButton).Repeat.Any().Return(new Button());
     Expect.Call(mockForm.LabelPageTitle).Return(new Label());
     Expect.Call(mockForm.PageContainer).Repeat.Any().Return(new Panel());
 }
コード例 #5
0
 private void SetUpCommonExpectationsOnFormFactory(IWizardFormFactory formFactory, WizardForm mockForm)
 {
     Expect.Call(formFactory.NewForm()).Return(mockForm);
 }
コード例 #6
0
ファイル: WizardTest.cs プロジェクト: notpod/Notpod
 private void SetUpCommonExpectationsOnFormFactory(IWizardFormFactory formFactory, WizardForm mockForm)
 {
     Expect.Call(formFactory.NewForm()).Return(mockForm);
 }