public void ParseArgsForMerge(params string[] args)
 {
     var(command, files, mergefields) = ParseArgs.FromStringArray(args);
     command.ShouldBe(Program.Command.Merge);
     files[0].Item1.Name.ShouldBe(args[0]);
     files[0].Item2.Name.ShouldBe(args[1]);
     mergefields["a"].ShouldNotBeNull().ShouldBe("b");
     mergefields["aa"].ShouldNotBeNull().ShouldBe("bb");
 }
 public void ParseArgsForShowXml(params string[] args)
 {
     var(command, files, mergefields) = ParseArgs.FromStringArray(args);
     command.ShouldBe(Program.Command.ShowXml);
     files[0].Item1.Name.ShouldBe(args[1]);
     files[0].Item2.Name.ShouldBe(args[1]);
     files[1].Item1.Name.ShouldBe(args[2]);
     files[1].Item2.Name.ShouldBe(args[2]);
     files[2].Item1.Name.ShouldBe(args[3]);
     files[2].Item2.Name.ShouldBe(args[3]);
     files.Length.ShouldBe(args.Length - 1);
 }
Exemplo n.º 3
0
        public static void Main(string[] args)
        {
            HelpAndExitIfNot(args.Length > 0);

            Startup.Configure();

            var component = new MailMerger(
                Startup.CreateLogger <MailMerger>(),
                Startup.Settings
                );

            var(files, mergefields) = ParseArgs.FromStringArray(args);

            HelpAndExitIfNot(files.Length > 0);

            foreach (var(filein, fileout) in files)
            {
                component.Merge(filein.FullName, mergefields, fileout.FullName);
            }
        }