Esempio n. 1
0
        public void Parsing_ProvidingOptionToCommandWithMultiTemplateOption_ValidateAgainstAllTargets()
        {
            //Arrange
            var shortArguments = new[] { "-s", "ShortValue" };
            var longArguments  = new[] { "--long", "LongValue" };

            var command = new SubCommand();

            //Act
            command.Execute(shortArguments);
            var shortResult = command.MultiTemplateOption;

            command.Execute(longArguments);
            var longResult = command.MultiTemplateOption;

            //Assert
            Assert.Equal("ShortValue", shortResult);
            Assert.Equal("LongValue", longResult);
        }
Esempio n. 2
0
        public void Parsing_ProvidingSimpleTypeOption_FillOptionWithCorrectSimpleType()
        {
            //Arrange
            var arguments = new[] { "--long-type-option", long.MaxValue.ToString() };
            var command   = new SubCommand();

            //Act
            command.Execute(arguments);

            //Assert
            Assert.Equal(long.MaxValue, command.LongOption);
        }
Esempio n. 3
0
        public void Parsing_ProvidingComplexTypeArgument_FillArgumentWithCorrectComplexType()
        {
            //Arrange
            var arguments = new[] { "", "{\"StringProperty\":\"StringValue\",\"IntegerProperty\":1}" };
            var command   = new SubCommand();

            //Act
            command.Execute(arguments);

            //Assert
            Assert.Equal("StringValue", command.Custom.StringProperty);
            Assert.Equal(1, command.Custom.IntegerProperty);
        }
Esempio n. 4
0
        public void Parsing_ProvidingArgumentToCommandWithArgumentAndOption_FillArgumentAndLeaveOptionEmpty()
        {
            //Arrange
            var arguments = new[] { "argumentValue" };
            var command   = new SubCommand();

            //Act
            command.Execute(arguments);

            //Assert
            Assert.Equal("argumentValue", command.Simple);
            Assert.Null(command.MultiTemplateOption);
        }