public void DisablingWhileEnabledChangesIsEnabledToFalse() { var registrationControllerMock = MockRepository.GenerateMock<IHotKeyRegistrationController>(); registrationControllerMock.Stub(x => x.Register(Arg<IHotKey>.Is.Anything)).Return(0); registrationControllerMock.Stub(x => x.Unregister(Arg<IHotKey>.Is.Anything)).Return(true); var hotKey = new HotKey(registrationControllerMock); hotKey.Key = System.Windows.Forms.Keys.A; Assert.IsFalse(hotKey.IsEnabled); hotKey.Enable(); Assert.IsTrue(hotKey.IsEnabled); hotKey.Disable(); Assert.IsFalse(hotKey.IsEnabled); }
public void DisablingWhileDisabledSucceeds() { var registrationControllerMock = MockRepository.GenerateMock<IHotKeyRegistrationController>(); var hotKey = new HotKey( registrationControllerMock); Assert.DoesNotThrow(() => hotKey.Disable()); }