public void MainWorkflow_Calls_Subworkflows_In_Order()
        {
            var options = new Options(
                false,
                false,
                false,
                IgnoreFlags.Nothing,
                GroupStrategy.Date,
                TargetFilenameStrategy.TicksHex,
                null,
                @"E:\",
                @"F:\");

            // arrange
            var workflows = new[]
            {
                new TestWorkflow(1),
                new TestWorkflow(2),
                new TestWorkflow(3),
            };
            var mainWorkflow = new MainWorkflow(workflows);

            // act
            var files = mainWorkflow.Process(options, null);

            // assert
            Assert.Equal(
                files.OrderByDescending(f => f.FileName).First().FileName,
                files.Single(f => f.Valid).FileName);
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Process the files.
        /// </summary>
        /// <param name="options">The parsed options.</param>
        private static void ProcessFiles(Options options)
        {
            WorkflowWriter.WriteLine(options.ToString());
            IFileSystem fileSystem     = new FileSystemHandler();
            IWorkflow   parse          = new ParseWorkflow(fileSystem);
            IWorkflow   validation     = new ValidateWorkflow(fileSystem);
            IWorkflow   filterWorkflow = new FilterWorkflow();
            IWorkflow   process        = new ProcessWorkflow(filterWorkflow);
            IWorkflow   target         = new TargetWorkflow();
            IWorkflow   copy           = new CopyWorkflow(fileSystem);
            IWorkflow   mainworkflow   = new MainWorkflow(
                parse,
                validation,
                process,
                target,
                copy);

            try
            {
                var result = mainworkflow.Process(options, Array.Empty <AstroFile>());
            }
            catch (Exception ex)
            {
                WorkflowWriter.WriteLine($"Error encountered: {ex.Message}.");
            }

            return;
        }