public void Getopt_mode_can_have_EnableDashDash_expicitly_disabled()
        {
            // Arrange
            var sut = new Parser(config => {
                config.GetoptMode     = true;
                config.PosixlyCorrect = false;
                config.EnableDashDash = false;
            });
            var args     = new string [] { "--stringvalue", "foo", "256", "--", "-x", "-sbar" };
            var expected = new Simple_Options_WithExtraArgs {
                StringValue  = "foo",
                ShortAndLong = "bar",
                BoolValue    = true,
                LongValue    = 256,
                IntSequence  = Enumerable.Empty <int>(),
                ExtraArgs    = new [] { "--" },
            };

            // Act
            var result = sut.ParseArguments <Simple_Options_WithExtraArgs>(args);

            // Assert
            result.Should().BeOfType <Parsed <Simple_Options_WithExtraArgs> >();
            result.As <Parsed <Simple_Options_WithExtraArgs> >().Value.Should().BeEquivalentTo(expected);
        }
        public void Getopt_parser_with_posixly_correct_stops_parsing_at_first_nonoption(string[] args, Simple_Options_WithExtraArgs expected)
        {
            // Arrange
            var sut = new Parser(config => {
                config.GetoptMode     = true;
                config.PosixlyCorrect = true;
                config.EnableDashDash = true;
            });

            // Act
            var result = sut.ParseArguments <Simple_Options_WithExtraArgs>(args);

            // Assert
            result.Should().BeOfType <Parsed <Simple_Options_WithExtraArgs> >();
            result.As <Parsed <Simple_Options_WithExtraArgs> >().Value.Should().BeEquivalentTo(expected);
        }
        public void Getopt_parser_without_posixly_correct_allows_mixed_options_and_nonoptions(string[] args, Simple_Options_WithExtraArgs expected)
        {
            // Arrange
            var sut = new Parser(config => {
                config.GetoptMode     = true;
                config.PosixlyCorrect = false;
            });

            // Act
            var result = sut.ParseArguments <Simple_Options_WithExtraArgs>(args);

            // Assert
            if (result is Parsed <Simple_Options_WithExtraArgs> parsed)
            {
                parsed.Value.Should().BeEquivalentTo(expected);
            }
            else if (result is NotParsed <Simple_Options_WithExtraArgs> notParsed)
            {
                Console.WriteLine(String.Join(", ", notParsed.Errors.Select(err => err.Tag.ToString())));
            }
            result.Should().BeOfType <Parsed <Simple_Options_WithExtraArgs> >();
            result.As <Parsed <Simple_Options_WithExtraArgs> >().Value.Should().BeEquivalentTo(expected);
        }