Beispiel #1
0
        public void TestDrawOrderChangedEvent()
        {
            IDrawableComponentSubscriber subscriber = mockSubscriber(this.testComponent);

            Expect.Once.On(subscriber).Method("DrawOrderChanged").WithAnyArguments();
            this.testComponent.DrawOrder = 4321;

            this.mockery.VerifyAllExpectationsHaveBeenMet();
        }
Beispiel #2
0
        public void TestVisibleChangedEvent()
        {
            this.testComponent.Visible = false;

            IDrawableComponentSubscriber subscriber = mockSubscriber(this.testComponent);

            Expect.Once.On(subscriber).Method("VisibleChanged").WithAnyArguments();
            this.testComponent.Visible = true;
            this.mockery.VerifyAllExpectationsHaveBeenMet();
        }
Beispiel #3
0
        /// <summary>Mocks a subscriber for the events of a tracker</summary>
        /// <param name="drawableComponent">Component to mock an event subscriber for</param>
        /// <returns>The mocked event subscriber</returns>
        private IDrawableComponentSubscriber mockSubscriber(
            DrawableComponent drawableComponent
            )
        {
            IDrawableComponentSubscriber mockedSubscriber =
                this.mockery.NewMock <IDrawableComponentSubscriber>();

            drawableComponent.DrawOrderChanged += new DeviceEventHandler(
                mockedSubscriber.DrawOrderChanged
                );
            drawableComponent.VisibleChanged += new DeviceEventHandler(
                mockedSubscriber.VisibleChanged
                );

            return(mockedSubscriber);
        }