示例#1
0
        public void TestChoiceWithoutParent()
        {
            ChoiceControl choice = new ChoiceControl();

            choice.Bounds = new UniRectangle(10, 10, 100, 100);

            IChoiceSubscriber mockedSubscriber = mockSubscriber(choice);

            Expect.Once.On(mockedSubscriber).Method("Changed").WithAnyArguments();

            Assert.IsFalse(choice.Selected);

            // Move the mouse over the choice and do a left-click
            choice.ProcessMouseMove(0, 0, 50, 50);
            choice.ProcessMousePress(MouseButtons.Left);
            choice.ProcessMouseRelease(MouseButtons.Left);

            this.mockery.VerifyAllExpectationsHaveBeenMet();

            Assert.IsTrue(choice.Selected);
        }
        public void TestClickOnSelectedChoice()
        {
            ChoiceControl choice = new ChoiceControl();

            choice.Bounds = new UniRectangle(10, 10, 100, 100);

            choice.Selected = true;

            Mock <IChoiceSubscriber> mockedSubscriber = mockSubscriber(choice);

            mockedSubscriber.Expects.No.Method(m => m.Changed(null, null)).WithAnyArguments();

            Assert.IsTrue(choice.Selected);

            // Move the mouse over the choice and do a left-click
            choice.ProcessMouseMove(0, 0, 50, 50);
            choice.ProcessMousePress(MouseButtons.Left);
            choice.ProcessMouseRelease(MouseButtons.Left);

            this.mockery.VerifyAllExpectationsHaveBeenMet();

            Assert.IsTrue(choice.Selected);
        }
    public void TestChoiceWithoutParent() {
      ChoiceControl choice = new ChoiceControl();
      choice.Bounds = new UniRectangle(10, 10, 100, 100);

      IChoiceSubscriber mockedSubscriber = mockSubscriber(choice);
      Expect.Once.On(mockedSubscriber).Method("Changed").WithAnyArguments();

      Assert.IsFalse(choice.Selected);

      // Move the mouse over the choice and do a left-click
      choice.ProcessMouseMove(0, 0, 50, 50);
      choice.ProcessMousePress(MouseButtons.Left);
      choice.ProcessMouseRelease(MouseButtons.Left);

      this.mockery.VerifyAllExpectationsHaveBeenMet();

      Assert.IsTrue(choice.Selected);
    }