Пример #1
0
        public void ButtonLabelShouldBeControllerValue()
        {
            controller = mockRepository.DynamicMock<IAppController>();

            using (mockRepository.Record())
            {
                Expect.
                    On(controller).
                    Call(controller.GetData()).
                    Return(UpdatedValue);
            }
            using (mockRepository.Playback())
            {
                alternateAppForm = new AlternateAppForm(controller);
                alternateAppForm.Show();

                ButtonTester button = new ButtonTester("countButton");
                button["Text"] = TestValue;

                Assert.AreEqual(TestValue, button.Text);
            }
        }
Пример #2
0
        public void ButtonLabelShouldUpdateAfterClick()
        {
            controller = mockRepository.DynamicMock<IAppController>();

            using (mockRepository.Record())
            {
                Expect.
                    On(controller).
                    Call(controller.GetData()).
                    Return(UpdatedValue).
                    Repeat.Twice();
            }
            using (mockRepository.Playback())
            {
                alternateAppForm = new AlternateAppForm(controller);
                alternateAppForm.Show();

                ButtonTester button = new ButtonTester("countButton");
                button.Click();

                LabelTester countLabel = new LabelTester("countLabel");
                Assert.AreEqual(UpdatedValue, countLabel.Text);
            }
        }
Пример #3
0
        public void ShowModalButtonShouldInvokeControllerShowModal()
        {
            controller = mockRepository.DynamicMock<IAppController>();
            using (mockRepository.Record())
            {
                Expect.
                    On(controller).
                    Call(controller.GetData()).
                    Return(TestValue);
            }
            using (mockRepository.Playback())
            {
                alternateAppForm = new AlternateAppForm(controller);
                alternateAppForm.Show();

                ButtonTester button = new ButtonTester("showModalButton");
                button.Click();
            }
        }
Пример #4
0
        public void CountButtonShouldInvokeControllerCount()
        {
            controller = mockRepository.DynamicMock<IAppController>();

            using (mockRepository.Record())
            {
                Expect.
                    On(controller).
                    Call(controller.GetData()).
                    Return(TestValue).
                    Repeat.Twice();

                controller.Count();
                LastCall.Repeat.Once();
            }
            using (mockRepository.Playback())
            {
                alternateAppForm = new AlternateAppForm(controller);
                alternateAppForm.Show();

                ButtonTester button = new ButtonTester("countButton");
                button.Click();
            }
        }