public void ParseArgument_ShouldParseArgumentWithLabel()
        {
            var specification = CreateLabeledValueSpecification();

            var argument = specification.ParseArgument(Label, Value);

            OptionValueSpecificationTest.AssertArgumentIsValueArgument(Label, Value, argument);
        }
Beispiel #2
0
        public void ParseArgument_ShouldParseCommandIfItExistsInArgument()
        {
            var specification = CreateSpecification();

            var argument = specification.ParseArgument(null, Command);

            OptionValueSpecificationTest.AssertArgumentIsCommandArgument(Command, argument);
        }
        public void ParseArguments_ShouldParseDownloadSpecificationCorrectly()
        {
            var version   = "1.2.3";
            var arguments = ChefDownloadOptionSpecification.ParseArguments("chef", "download", version);

            arguments.Length.Should().Be(3, "because there are three arguments");
            OptionValueSpecificationTest.AssertArgumentIsCommandArgument("chef", arguments[0]);
            OptionValueSpecificationTest.AssertArgumentIsCommandArgument("download", arguments[1]);
            OptionValueSpecificationTest.AssertArgumentIsValueArgument("version:", version, arguments[2]);
        }
        public void ParseArguments_ShouldParseCommandAndTwoLabels()
        {
            const string groupLabel    = "group:";
            const string policyLabel   = "policy:";
            var          specification = new OptionSpecification(OptionValueSpecification.ForCommand("chef"),
                                                                 OptionValueSpecification.ForValue(policyLabel, "the policy"),
                                                                 OptionValueSpecification.ForValue(groupLabel, "the group"));

            const string policyValue = "policy-value";
            const string groupValue  = "group-value";
            var          arguments   = specification.ParseArguments("chef", policyLabel, policyValue, groupLabel, groupValue);

            arguments.Should().NotBeNull("because the arguments fit the specification");
            arguments.Length.Should().Be(3);
            OptionValueSpecificationTest.AssertArgumentIsCommandArgument("chef", arguments[0]);
            OptionValueSpecificationTest.AssertArgumentIsValueArgument(policyLabel, policyValue, arguments[1]);
            OptionValueSpecificationTest.AssertArgumentIsValueArgument(groupLabel, groupValue, arguments[2]);
        }