Exemplo n.º 1
0
        public void SetRepeat_ThrowsOnNull()
        {
            Assert.ThrowsException <ArgumentNullException>(
                () => KeyEventArgsExtensions.SetRepeat(null, true)
                );

            Assert.ThrowsException <ArgumentNullException>(
                () => KeyEventArgsExtensions.SetRepeat(null, false)
                );
        }
Exemplo n.º 2
0
        public void SetRepeat_SetsProperty()
        {
            var keArgs = new KeyEventArgs(
                keyboard: Keyboard.PrimaryDevice,
                inputSource: new HwndSource(0, 0, 0, 0, 0, String.Empty, IntPtr.Zero),
                timestamp: 0,
                key: Key.A
                );

            Assert.IsFalse(keArgs.IsRepeat);

            KeyEventArgsExtensions.SetRepeat(keArgs, true);

            Assert.IsTrue(keArgs.IsRepeat);

            KeyEventArgsExtensions.SetRepeat(keArgs, false);

            Assert.IsFalse(keArgs.IsRepeat);
        }