Exemple #1
0
        public void FindHotKeyIdWillReturnNullIfNotRegistered()
        {
            using (var dummyHotKeyManager = new DummyHotKeyManager())
            {
                // Arrange
                var hotKeyModifier = HotKeyModifier.Alt | HotKeyModifier.Shift | HotKeyModifier.Control;
                var virtualKeyCode = (UInt32)65; // A

                // Act
                var registeredHotKeyId = dummyHotKeyManager.FindHotKeyId(hotKeyModifier, virtualKeyCode);

                // Assert
                registeredHotKeyId.Should().Be(null);
            }
        }
Exemple #2
0
        public void FindHotKeyIdWillReturnIdIfRegistered()
        {
            using (var dummyWindow = DummyWindow.Create())
            {
                using (var dummyHotKeyManager = new DummyHotKeyManager())
                {
                    // Arrange
                    var    hotKeyModifier = HotKeyModifier.Alt | HotKeyModifier.Shift | HotKeyModifier.Control;
                    var    virtualKeyCode = (UInt32)65; // A
                    Action hotKeyAction   = () => { };
                    var    hotKeyId       = dummyHotKeyManager.Register(dummyWindow, hotKeyModifier, virtualKeyCode, hotKeyAction);

                    // Act
                    var registeredHotKeyId = dummyHotKeyManager.FindHotKeyId(hotKeyModifier, virtualKeyCode);

                    // Assert
                    registeredHotKeyId.Should().Be(hotKeyId);
                }
            }
        }