Exemplo n.º 1
0
        public void Arguments_should_be_correctly_assembled_to_a_string()
        {
            var args = new CmdArgumentsService();
            args.Set("Arg1","1");
            args.Set("Arg2", null);
            args.Set("Arg3", "\"2\"");

            Assert.AreEqual("Arg1=1 Arg2 Arg3=\"\"\"2\"\"\"", args.ToCommandLineString());
        }
Exemplo n.º 2
0
        public void A_assembled_argument_string_should_be_parsed_the_the_same_result()
        {
            var args = new CmdArgumentsService();
            args.Set("key1", "value1");
            args.Set("key2", null);
            args.Set("key3", "value\"with\"quote");

            var result = PrepareInstance<ICmdArguments>(new CmdArgumentsService());
            PrepareInstance<ICmdParser>(new CmdParser());
            CreateInstance<CommandLine>().ParseArguments(args.ToCommandLineString());

            Assert.AreEqual(3, result.AllKeys.Length);
            Assert.AreEqual("value1", result.Get("key1"));
            Assert.AreEqual(null, result.Get("key2"));
            Assert.AreEqual("value\"with\"quote", result.Get("key3"));
        }