public void Should_use_property_name_as_long_name_if_omitted()
        {
            // Given
            var options = new OptionsWithImplicitLongName();
            var parser = new CommandLine.Parser();
            var arguments = new[] {
                "--segments", "header.txt:body.txt:footer.txt"
            };

            // When
            var result = parser.ParseArguments(arguments, options);

            // Than
            result.Should().Be(true);
            options.Segments.Should().HaveCount(c => c == 3);
            options.Segments.Should().ContainInOrder(new[] { "header.txt", "body.txt", "footer.txt" });
        }
        public void Should_use_property_name_as_long_name_if_omitted()
        {
            // Given
            var options = new OptionsWithImplicitLongName();
            var parser = new CommandLine.Parser();
            var arguments = new[] {
                "--offsets", "-2", "-1", "0", "1" , "2"
            };

            // When
            var result = parser.ParseArguments(arguments, options);

            // Than
            result.Should().Be(true);
            options.Offsets.Should().HaveCount(c => c == 5);
            options.Offsets.Should().ContainInOrder(new[] { -2, -1, 0, 1, 2 });
        }
Exemplo n.º 3
0
        public void Should_use_property_name_as_long_name_if_omitted()
        {
            // Given
            var options = new OptionsWithImplicitLongName();
            var parser = new CommandLine.Parser();
            var arguments = new[] {
                "--download", "something",
                "--up-load", "this",
                "-b", "1024"
            };

            // When
            var result = parser.ParseArguments(arguments, options);

            // Than
            result.Should().Be(true);
            options.Download.Should().Be("something");
            options.Upload.Should().Be("this");
            options.Bytes.Should().Be(1024);
        }