public void TestButtonPressByMouse() {
      ButtonControl button = new ButtonControl();
      button.Bounds = new UniRectangle(10, 10, 100, 100);

      IButtonSubscriber mockedSubscriber = mockSubscriber(button);
      Expect.Once.On(mockedSubscriber).Method("Pressed").WithAnyArguments();

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

      this.mockery.VerifyAllExpectationsHaveBeenMet();
    }
示例#2
0
        public void TestButtonPressByMouse()
        {
            ButtonControl button = new ButtonControl();

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

            IButtonSubscriber mockedSubscriber = mockSubscriber(button);

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

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

            this.mockery.VerifyAllExpectationsHaveBeenMet();
        }
示例#3
0
        public void TestLastSecondAbortByMouse()
        {
            ButtonControl button = new ButtonControl();

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

            Mock <IButtonSubscriber> mockedSubscriber = mockSubscriber(button);

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

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

            this.mockery.VerifyAllExpectationsHaveBeenMet();
        }