コード例 #1
0
ファイル: NewKMapCommandTests.cs プロジェクト: codito/oshell
        public async Task NewKMapCommandHandlerExecuteThrowsForExistingKeyMap()
        {
            var command = new NewKMapCommand { Args = "dummyKeyMap" };
            var commandHandler = new NewKMapCommandHandler(this.keyMapService);
            (await commandHandler.Execute(command)).Should().BeTrue();

            Func<Task> action = async () => await commandHandler.Execute(command);
            action.ShouldThrow<ArgumentException>();
        }
コード例 #2
0
ファイル: NewKMapCommandTests.cs プロジェクト: codito/oshell
        public async Task NewKMapCommandHandlerExecuteShouldCreateANewKeyMapWithDefinedTopKey()
        {
            var command = new NewKMapCommand { Args = "dummyKeyMap" };
            var commandHandler = new NewKMapCommandHandler(this.keyMapService);
            var result = await commandHandler.Execute(command);
            result.Should().BeTrue();

            var keyMap = this.keyMapService.GetKeyMapByName("dummyKeyMap");
            keyMap.Should().NotBeNull();
            keyMap.TopKey.ShouldBeEquivalentTo(Keys.None);
        }
コード例 #3
0
ファイル: DelKMapCommandTests.cs プロジェクト: codito/oshell
        public async Task DelKMapCommandHandlerExecuteShouldDeleteAKeyMapWithGivenName()
        {
            var delkmapHandler = new DelKMapCommandHandler(this.keyMapService);
            var newkmapHandler = new NewKMapCommandHandler(this.keyMapService);
            (await newkmapHandler.Execute(new NewKMapCommand { Args = "dummyKeyMap" })).Should().BeTrue();

            var result = await delkmapHandler.Execute(new DelKMapCommand { Args = "dummyKeyMap" });
            result.Should().BeTrue();

            var getKeyMap = new Action(() => this.keyMapService.GetKeyMapByName("dummyKeyMap"));
            getKeyMap.ShouldThrow<KeyNotFoundException>();
        }
コード例 #4
0
ファイル: NewKMapCommandTests.cs プロジェクト: codito/oshell
 public async Task NewKMapCommandHandlerExecuteShouldReturnFalseForCommandWithoutArguments()
 {
     var command = new NewKMapCommand { Args = null };
     var commandHandler = new NewKMapCommandHandler(this.keyMapService);
     (await commandHandler.Execute(command)).Should().BeFalse();
 }