Exemplo n.º 1
0
 public static void UnParsing_immutable_instance_returns_command_line(Immutable_Simple_Options options, string result)
 {
     new Parser()
         .FormatCommandLine(options)
         .ShouldBeEquivalentTo(result);
 }
Exemplo n.º 2
0
        public void Parse_to_immutable_instance(string[] arguments, Immutable_Simple_Options expected)
        {
            // Fixture setup in attributes

            // Exercize system
            var result = InstanceBuilder.Build(
                Maybe.Nothing<Func<Immutable_Simple_Options>>(),
                arguments,
                StringComparer.Ordinal,
                CultureInfo.InvariantCulture,
                Enumerable.Empty<ErrorType>());

            // Verify outcome
            expected.ShouldBeEquivalentTo(((Parsed<Immutable_Simple_Options>)result).Value);

            // Teardown
        }
Exemplo n.º 3
0
        public void Parse_to_immutable_instance()
        {
            // Fixture setup
            var expectedOptions = new Immutable_Simple_Options("strvalue", new[] { 1, 2, 3 }, default(bool), default(long));
            var sut = new Parser();

            // Exercize system
            var result = sut.ParseArguments<Immutable_Simple_Options>(new[] { "--stringvalue=strvalue", "-i1", "2", "3" });

            // Verify outcome
            ((Parsed<Immutable_Simple_Options>)result).Value.ShouldBeEquivalentTo(expectedOptions);
            // Teardown
        }