public void UndefinekeyCommandHandlerExecuteThrowsForInvalidCommandArgs() { var invalidArgs = new[] { null, string.Empty, "arg1", "arg1 arg2 arg3", TestKeyMap + " NotAKey" }; var undefinekeyCommandHandler = new UndefinekeyCommandHandler(this.keyMapService); foreach (var invalidArg in invalidArgs) { var undefinekeyCommand = new UndefinekeyCommand { Args = invalidArg }; Func<Task> action = async () => await undefinekeyCommandHandler.Execute(undefinekeyCommand); action.ShouldThrow<ArgumentException>(); } }
public async Task UndefinekeyCommandHandlerExecuteUnregistersAKeySequence() { var keySequences = new[] { "A", "Control+T", "Control+Shift+Alt+T" }; var undefinekeyCommandHandler = new UndefinekeyCommandHandler(this.keyMapService); var keymap = this.keyMapService.GetKeyMapByName(TestKeyMap); foreach (var keySequence in keySequences) { var undefinekeyCommand = new UndefinekeyCommand { Args = TestKeyMap + " " + keySequence }; (await undefinekeyCommandHandler.Execute(undefinekeyCommand)).Should().BeTrue(); var registerKey = new Action( () => { keymap.RegisterAction((Keys)new KeysConverter().ConvertFrom(keySequence), args => Task.Run(() => true)); }); registerKey.ShouldNotThrow(); } }
public void UndefinekeyCommandHasNameAsUndefinekey() { var undefinekey = new UndefinekeyCommand(); undefinekey.Name.Should().Be("undefinekey"); }