public void HandleHotKeyWillReturnTrueAndCallActionIfHotKeyWasFound() { using (var dummyWindow = DummyWindow.Create()) { using (var dummyHotKeyManager = new DummyHotKeyManager()) { // Arrange var hotKeyModifier = HotKeyModifier.Alt | HotKeyModifier.Shift | HotKeyModifier.Control; var virtualKeyCode = (UInt32)65; // A var hotKeyActionSet = false; Action hotKeyAction = () => { hotKeyActionSet = true; }; dummyHotKeyManager.Register(dummyWindow, hotKeyModifier, virtualKeyCode, hotKeyAction); // Act var handleHotKeyResult = dummyHotKeyManager.HandleHotKey(hotKeyModifier, virtualKeyCode); // Assert handleHotKeyResult.Should().BeTrue(); hotKeyActionSet.Should().BeTrue(); } } }
public void HandleHotKeyWillReturnFalseIfHotKeyWasNotFound() { using (var dummyHotKeyManager = new DummyHotKeyManager()) { // Arrange var hotKeyModifier = HotKeyModifier.Alt | HotKeyModifier.Shift | HotKeyModifier.Control; var virtualKeyCode = (UInt32)65; // A // Act var handleHotKeyResult = dummyHotKeyManager.HandleHotKey(hotKeyModifier, virtualKeyCode); // Assert handleHotKeyResult.Should().BeFalse(); } }