public void TestReportsKeyAsPressedAfterKeyDown()
        {
            _input.SetUserId(1);

            _input.KeyDown(Keys.Enter);

            Assert.True(_input.IsKeyDown(Keys.Enter));
        }
Exemplo n.º 2
0
        private static void HookInputEvents(ClientForm form, ClientFormInput input)
        {
            form.KeyUp += (object sender, KeyEventArgs e) => {
                input.KeyUp(e.KeyCode);
            };

            form.KeyDown += (object sender, KeyEventArgs e) => {
                input.KeyDown(e.KeyCode);
            };
        }
        public void Put(Keys key)
        {
            ClientFormInput input = new ClientFormInput();

            input.SetUserId(1);
            input.Initialize(1);
            input.KeyDown(key);
            var result = input.IsUserKeyDown(1, key);

            Assert.True(result);
        }
        public void TestOverridesWithPressedKeysFromSeparateInstance()
        {
            var otherInput = new ClientFormInput();

            otherInput.SetUserId(1);
            _input.SetUserId(1);

            otherInput.KeyDown(Keys.Up);
            _input.KeyDown(Keys.Enter);

            _input.Merge(otherInput);

            Assert.False(_input.IsKeyDown(Keys.Enter));
            Assert.True(_input.IsKeyDown(Keys.Up));
        }