示例#1
0
        public static void Main(string[] args)
        {
            CommandLineApplication commandLineApplication = new CommandLineApplication(false);

            CommandOption directory    = commandLineApplication.Option("-d |--directory <directory>", "The directory containing aggregate report emails", CommandOptionType.SingleValue);
            CommandOption xmlDirectory = commandLineApplication.Option("-x |--xml <xmldirectory>", "The directory to write xml aggregate reports to", CommandOptionType.SingleValue);
            CommandOption csvFile      = commandLineApplication.Option("-c |--csv <csvfile>", "The csv file to write denormalised records to", CommandOptionType.SingleValue);
            CommandOption sqlFile      = commandLineApplication.Option("-s |--sqlite <sqlitefile>", "The sqlite file to write denormalised records to", CommandOptionType.SingleValue);

            commandLineApplication.HelpOption("-? | -h | --help");

            commandLineApplication.OnExecute(() =>
            {
                CommandLineArgs commandLineArgs = new CommandLineArgs(directory.Value(), xmlDirectory.Value(),
                                                                      csvFile.Value(), sqlFile.Value());

                IFileAggregateReportProcessor processor = FileAggregateReportProcessorFactory.Create(commandLineArgs);

                processor.Process(commandLineArgs.Directory.GetFiles().ToList()).GetAwaiter().GetResult();

                return(0);
            });

            commandLineApplication.Command("lambda", command =>
            {
                command.Description = "Run aggregate report processor lambda code locally.";

                command.OnExecute(() =>
                {
                    RunLambda().ConfigureAwait(false).GetAwaiter().GetResult();
                    return(0);
                });
            }, false);

            commandLineApplication.Execute(args);
        }
        public void TestCreation(CommandLineArgs commandLineArgs)
        {
            IFileAggregateReportProcessor fileEmailMessageProcessor = FileAggregateReportProcessorFactory.Create(commandLineArgs);

            Assert.That(fileEmailMessageProcessor, Is.Not.Null);
        }