Пример #1
0
        public void Parse_to_immutable_instance()
        {
            // Fixture setup
            var expectedOptions = new FakeImmutableOptions(
                "strvalue", new[] { 1, 2, 3 }, default(bool), default(long));
            var sut = new Parser();

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

            // Verify outcome
            ((Parsed <FakeImmutableOptions>)result).Value.ShouldBeEquivalentTo(expectedOptions);
            // Teardown
        }
Пример #2
0
        public void Parse_to_immutable_instance(string[] arguments, FakeImmutableOptions expected)
        {
            // Fixture setup in attributes

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

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

            // Teardown
        }
 public static void UnParsing_immutable_instance_returns_command_line(FakeImmutableOptions options, string result)
 {
     new Parser()
     .FormatCommandLine(options)
     .ShouldBeEquivalentTo(result);
 }