Exemple #1
0
        public void key_with_modifiers_raises_a_new_message()
        {
            // arrange
            messageProvider.Subscribe(this);
            KeyStreams.LetterL().Play(interceptKeysSource);

            // act
            KeyStreams.CtrlShiftL().Play(interceptKeysSource);

            // assert
            Assert.Equal(2, messages.Count);
        }
Exemple #2
0
        public void ctrlshiftl_is_processed_correctly()
        {
            // arrange
            var player   = KeyStreams.CtrlShiftL();
            var provider = new KeyProvider(player, passwordModeService, desktopLockEventService);

            // act
            var processedKeys = ToEnumerable(provider, player);

            // assert
            Assert.Equal(new[] { "Ctrl", "Shift", "L" }, processedKeys.Single().Input);
        }
Exemple #3
0
        public async Task ctrlshiftl_is_processed_correctly()
        {
            // arrange
            var player   = KeyStreams.CtrlShiftL();
            var provider = new KeyProvider(player, passwordModeService, desktopLockEventService, settingsProvider);

            // act
            var processedKeys = await provider.GetKeyStream().ToList();

            // assert
            Assert.Equal(new[] { "Ctrl", "Shift", "L" }, processedKeys.Single().Input);
        }
        public void key_with_modifiers_raises_a_new_message()
        {
            // arrange
            var keySequence = KeyStreams.LetterL()
                              .Concat(KeyStreams.CtrlShiftL())
                              .ToObservable();
            var sut = CreateMessageProvider(keySequence);

            // act
            var messages = sut.GetMessageStream().ToList().Single();

            // assert
            Assert.Equal(2, messages.Count);
        }
Exemple #5
0
        public void recognises_shortcuts()
        {
            // arrange
            messageProvider.Subscribe(this);
            shortcutProvider.GetShortcutsMatching(Arg.Any <IEnumerable <KeyPress> >())
            .Returns(new [] { new KeyShortcut("MyShortcut", new KeyPressDefinition(Keys.L, shiftPressed: true, controlPressed: true)) });

            // act
            KeyStreams.CtrlShiftL().Play(interceptKeysSource);

            // assert
            Assert.Equal(1, messages.Count);
            Assert.Equal("MyShortcut", messages[0].ShortcutName);
        }
Exemple #6
0
        public void recognises_shortcuts()
        {
            // arrange
            messageProvider.GetMessageStream(keysStream).Subscribe(value => messages.Add(value));
            shortcutProvider.GetShortcutsStartingWith(Arg.Any <KeyPress>())
            .Returns(new List <KeyShortcut> {
                new KeyShortcut("MyShortcut", new KeyPressDefinition(Keys.L, shiftPressed: true, controlPressed: true))
            });

            // act
            KeyStreams.CtrlShiftL().Play(interceptKeysSource);

            // assert
            Assert.Equal(1, messages.Count);
            Assert.Equal("MyShortcut", messages[0].ShortcutName);
        }
        public void recognises_shortcuts()
        {
            // arrange
            var keySequence = KeyStreams.CtrlShiftL().ToObservable();
            var sut         = CreateMessageProvider(keySequence);

            shortcutProvider.GetShortcutsStartingWith(Arg.Any <KeyPress>())
            .Returns(new List <KeyShortcut> {
                new KeyShortcut("MyShortcut", new KeyPressDefinition(Keys.L, shiftPressed: true, controlPressed: true))
            });

            // act
            var messages = sut.GetMessageStream().ToList().Single();

            // assert
            Assert.Equal(1, messages.Count);
            Assert.Equal("MyShortcut", messages[0].ShortcutName);
        }