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); }
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); }
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); }
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); }
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); }