public void ComandDispatch_ShouldOverwriteProperties()
        {
            var command = new OverwriteCommand();
            var args    = new[] { "/A", "1", "/B", "2" };

            CommandDispatcher.AssertWorksCorrectly(command, args);
            command.Result.Should().Be("1,2");
        }
        public void CommandDispatch_WithParameters_ShouldParseItCorrectly(params string[] args)
        {
            var command = new TestCommand()
                          .IsCommand("Example")
                          .HasOption("f|foo=", "This foo to use.", v => v.Should().Be("bar"))
                          .SkipsCommandSummaryBeforeRunning();

            CommandDispatcher.AssertWorksCorrectly(command, args);
        }
        public void CommandDispatch_WithCorrectCountOfParameters_ShouldWorkFine()
        {
            var command = new TestCommand()
                          .IsCommand("command")
                          .HasAdditionalArguments(5);

            var args = new[] { "command", "1", "2", "3", "4", "5" };

            CommandDispatcher.AssertWorksCorrectly(command, args);
        }
        public void CommandDispatch_ShouldParseIntCorrectly()
        {
            var command = new TestCommand()
                          .IsCommand("parse-int")
                          .HasRequiredOption <int>("value=", "The integer value", v => v.Should().Be(42));

            var args = new[] { "parse-int", "-value", "42" };

            CommandDispatcher.AssertWorksCorrectly(command, args);
        }
        public void CommandDispatch_WithRequiredParameters_ShouldNotThrowAndHaveCorrectValue()
        {
            var command = new TestCommand()
                          .IsCommand("required", "This command has a required parameter")
                          .HasOption("ignored=", "An extra option.", v => { })
                          .HasRequiredOption("f|foo=", "This foo to use.", v => v.Should().Be("bar"))
                          .SkipsCommandSummaryBeforeRunning();

            var args = new[] { "required", "-foo", "bar" };

            CommandDispatcher.AssertWorksCorrectly(command, args);
        }