/// <summary>Creates a mocked subscriber for the controller detector</summary> /// <returns>The mocked subscriber</returns> private IControllerDetectorSubscriber mockSubscriber() { IControllerDetectorSubscriber subscriber = this.mockery.NewMock < IControllerDetectorSubscriber >(); this.detector.ControllerDetected += subscriber.ControllerDetected; return(subscriber); }
public void TestGamePad(PlayerIndex playerIndex) { IControllerDetectorSubscriber subscriber = mockSubscriber(); Expect.Once.On(subscriber).Method("ControllerDetected").With( NMock2.Is.Anything, new ControllerEventArgsMatcher(playerIndex) ); // Begin monitoring input devices this.detector.Start(); // Press the left mouse button and read the new mouse state this.inputManager.GetGamePad(playerIndex).Press(Buttons.Y); this.inputManager.Update(); this.mockery.VerifyAllExpectationsHaveBeenMet(); }