示例#1
0
        public void Parse_SucceedsWithParameters()
        {
            var definition = OptionsDefinition.GetDefinition <WithParameters>();

            var parsed = (WithParameters)definition.Parse("--version=hello", "--include", "sys.obj");

            Assert.That(parsed.Version, Is.EqualTo("hello"));
            Assert.That(parsed.Include, Is.EqualTo("sys.obj"));
        }
示例#2
0
        public void Parse_SucceedsWithCommands()
        {
            var definition = OptionsDefinition.GetDefinition <WithCommands>();

            var parsed = (WithCommands)definition.Parse("InnerCommand1");

            Assert.That(parsed.Command1, Is.Not.Null);
            Assert.That(parsed.Command2, Is.Null);
        }
示例#3
0
        public void Parse_SucceedsWithNestedParameters()
        {
            var definition = OptionsDefinition.GetDefinition <WithNestedParameters>();

            var parsed = (WithNestedParameters)definition.Parse("OuterCommand2", "--version=hello", "--include", "sys.obj");

            Assert.That(parsed.Command1, Is.Null);
            Assert.That(parsed.Command2, Is.Not.Null);
            Assert.That(parsed.Command2.Version, Is.EqualTo("hello"));
            Assert.That(parsed.Command2.Include, Is.EqualTo("sys.obj"));
        }