private void TestKeyHandler_KeyCombinationHandler_Repeat() { var keyCombinationHandler = new KeyCombinationHandler(VirtualKeyCode.Print); var keyPrintDown = new KeyboardHookEventArgs { Key = VirtualKeyCode.Print, IsKeyDown = true }; var keyPrintUp = new KeyboardHookEventArgs { Key = VirtualKeyCode.Print, IsKeyDown = false }; var result = keyCombinationHandler.Handle(keyPrintDown); Assert.True(result); result = keyCombinationHandler.Handle(keyPrintDown); Assert.False(result); // Key up again result = keyCombinationHandler.Handle(keyPrintUp); Assert.False(result); result = keyCombinationHandler.Handle(keyPrintDown); Assert.True(result); }
private void TestKeyHandler_KeyCombinationHandler_KeyUp() { var keyCombinationHandler = new KeyCombinationHandler(VirtualKeyCode.Print); var result = keyCombinationHandler.Handle(KeyDown(VirtualKeyCode.Print)); Assert.True(result); result = keyCombinationHandler.Handle(KeyDown(VirtualKeyCode.Control)); Assert.False(result); result = keyCombinationHandler.Handle(KeyUp(VirtualKeyCode.Control)); Assert.False(result); }