Beispiel #1
0
        /// <summary>Mocks a subscriber for the events of a slider</summary>
        /// <param name="mockery">Mockery through which the mock will be created</param>
        /// <param name="slider">Slider to mock an event subscriber for</param>
        /// <returns>The mocked event subscriber</returns>
        private static ISliderSubscriber mockSubscriber(
            Mockery mockery, SliderControl slider
            )
        {
            ISliderSubscriber mockedSubscriber = mockery.NewMock <ISliderSubscriber>();

            slider.Moved += new EventHandler(mockedSubscriber.Moved);
            return(mockedSubscriber);
        }
Beispiel #2
0
        public void TestMoveEvent()
        {
            using (Mockery mockery = new Mockery()) {
                DummySliderControl slider     = new DummySliderControl();
                ISliderSubscriber  subscriber = mockSubscriber(mockery, slider);

                Expect.Once.On(subscriber).Method("Moved").WithAnyArguments();
                slider.FireMoveEvent();

                mockery.VerifyAllExpectationsHaveBeenMet();
            }
        }