Exemplo n.º 1
0
        public void Options_should_be_separated_by_spaces()
        {
            // Fixture setup
            var handlers   = new CultureInfo("en-US").MakeCultureHandlers();
            var fakeResult =
                new NotParsed <Options_With_Default_Set_To_Sequence>(
                    typeof(Options_With_Default_Set_To_Sequence).ToTypeInfo(),
                    Enumerable.Empty <Error>()
                    );

            // Exercize system
            handlers.ChangeCulture();
            var helpText = HelpText.AutoBuild(fakeResult);

            handlers.ResetCulture();

            // Verify outcome
            var text  = helpText.ToString();
            var lines = text.ToLines().TrimStringArray();

            Console.WriteLine(text);
            lines[3].Should().Be("-z, --strseq    (Default: a b c)");
            lines[5].Should().Be("-y, --intseq    (Default: 1 2 3)");
            lines[7].Should().Be("-q, --dblseq    (Default: 1.1 2.2 3.3)");

            // Teardown
        }
Exemplo n.º 2
0
        public void Default_set_to_sequence_should_be_properly_printed()
        {
            // Fixture setup
            var handlers   = new CultureInfo("en-US").MakeCultureHandlers();
            var fakeResult =
                new NotParsed <Options_With_Default_Set_To_Sequence>(
                    typeof(Options_With_Default_Set_To_Sequence).ToTypeInfo(),
                    new Error[] { new BadFormatTokenError("badtoken") });

            // Exercize system
            handlers.ChangeCulture();
            var helpText = HelpText.AutoBuild(fakeResult);

            handlers.ResetCulture();

            // Verify outcome
            var text  = helpText.ToString();
            var lines = text.ToNotEmptyLines().TrimStringArray();

            lines[4].Should().Be("-z, --strseq    (Default: a b c)");
            lines[5].Should().Be("-y, --intseq    (Default: 1 2 3)");
            lines[6].Should().Be("-q, --dblseq    (Default: 1.1 2.2 3.3)");

            // Teardown
        }