Beispiel #1
0
        public void TestOptionToggleByMouse()
        {
            OptionControl option = new OptionControl();

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

            Mock <IOptionSubscriber> mockedSubscriber = mockSubscriber(option);

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

            Assert.IsFalse(option.Selected);

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

            this.mockery.VerifyAllExpectationsHaveBeenMet();

            Assert.IsTrue(option.Selected);
        }
Beispiel #2
0
        public void TestLastSecondAbortByMouse()
        {
            OptionControl option = new OptionControl();

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

            IOptionSubscriber mockedSubscriber = mockSubscriber(option);

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

            Assert.IsFalse(option.Selected);

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

            this.mockery.VerifyAllExpectationsHaveBeenMet();

            Assert.IsFalse(option.Selected);
        }