Beispiel #1
0
        public void ParseStrictBadInputFailsAndExits_GetUsageDefined()
        {
            var options = new SimpleOptionsForStrict();
            var testWriter = new StringWriter();

            Result = Parser.ParseArgumentsStrict(new string[] { "--bad", "--input" }, options, testWriter);

            ResultShouldBeFalse();

            var helpText = testWriter.ToString();
            Console.WriteLine(helpText);
            var lines = helpText.Split(new string[] { Environment.NewLine }, StringSplitOptions.RemoveEmptyEntries);
            // Did we really called user help method?
            lines.Should().Count.Exactly(1);
            // Verify just significant output
            lines[0].Trim().Should().Equal("SimpleOptionsForStrict (user defined)");
        }
Beispiel #2
0
        public void Parse_strict_bad_input_fails_and_exits_when_get_usage_is_defined()
        {
            var options = new SimpleOptionsForStrict();
            var testWriter = new StringWriter();

            ReflectionUtil.AssemblyFromWhichToPullInformation = Assembly.GetExecutingAssembly();
            var parser = new Parser();
            var result = parser.ParseArgumentsStrict(new string[] { "--bad", "--input" }, options, testWriter);

            result.Should().BeFalse();

            var helpText = testWriter.ToString();
            Console.WriteLine(helpText);
            var lines = helpText.Split(new string[] { Environment.NewLine }, StringSplitOptions.RemoveEmptyEntries);
            // Did we really called user help method?
            lines.Should().HaveCount(n => n == 1);
            // Verify just significant output
            lines[0].Trim().Should().Be("SimpleOptionsForStrict (user defined)");
        }