예제 #1
0
		public void UpdateKeyStates()
		{
			var mockKeyboard = new MockWindowsKeyboard();
			mockKeyboard.SetPressedKey(Key.A);
			var triggerPressing = new KeyTrigger(Key.A);
			mockKeyboard.Update(new[] { triggerPressing });
			Assert.AreEqual(State.Pressing, mockKeyboard.GetKeyboardState(Key.A));
			mockKeyboard.Update(new[] { triggerPressing });
			Assert.AreEqual(State.Pressed, mockKeyboard.GetKeyboardState(Key.A));
			mockKeyboard.SetReleasedKeys(Key.A);
			mockKeyboard.Update(new[] { new KeyTrigger(Key.A, State.Released) });
			Assert.AreEqual(State.Releasing, mockKeyboard.GetKeyboardState(Key.A));
		}
        public void UpdateKeyStates()
        {
            var mockKeyboard = new MockWindowsKeyboard();

            mockKeyboard.SetPressedKey(Key.A);
            var triggerPressing = new KeyTrigger(Key.A);

            mockKeyboard.Update(new[] { triggerPressing });
            Assert.AreEqual(State.Pressing, mockKeyboard.GetKeyboardState(Key.A));
            mockKeyboard.Update(new[] { triggerPressing });
            Assert.AreEqual(State.Pressed, mockKeyboard.GetKeyboardState(Key.A));
            mockKeyboard.SetReleasedKeys(Key.A);
            mockKeyboard.Update(new[] { new KeyTrigger(Key.A, State.Released) });
            Assert.AreEqual(State.Releasing, mockKeyboard.GetKeyboardState(Key.A));
        }