public void EnablingChangesIsEnabledToTrue() { var registrationControllerMock = MockRepository.GenerateMock<IHotKeyRegistrationController>(); registrationControllerMock.Stub(x => x.Register(Arg<IHotKey>.Is.Anything)).Return(0); var hotKey = new HotKey(registrationControllerMock); hotKey.Key = System.Windows.Forms.Keys.A; Assert.IsFalse(hotKey.IsEnabled); hotKey.Enable(); Assert.IsTrue(hotKey.IsEnabled); }
public void IdIsSetToControllerProvidedValueWhenHotKeyIsEnabled() { var id = 15; var registrationControllerMock = MockRepository.GenerateMock<IHotKeyRegistrationController>(); registrationControllerMock.Stub(x => x.Register(Arg<IHotKey>.Is.Anything)).Return(id); var hotKey = new HotKey(registrationControllerMock); hotKey.Key = System.Windows.Forms.Keys.A; Assert.AreNotEqual(id, hotKey.Id); hotKey.Enable(); Assert.AreEqual(id, hotKey.Id); }
public void EnablingHotKeyWithoutKeySetThrowsException() { var registrationControllerMock = MockRepository.GenerateMock<IHotKeyRegistrationController>(); var hotKey = new HotKey(registrationControllerMock); Assert.Throws<ArgumentException>(() => hotKey.Enable()); }