Exemplo n.º 1
0
        public async Task RunAsync(string[] args, CancellationToken cancellationToken)
        {
            var  filePath  = string.Empty;
            char separator = default(char);

            if (args.Length > 0)
            {
                filePath = args[0];
                _        = char.TryParse(args[1], out separator);
            }

            var userInputDto = _runService.GetUserInputValues(filePath, separator);
            var fileContents = await _runService.GetFileContents(userInputDto.InputFilePath);

            var enrollmentRows = _runService.GetEnrollmentRows(fileContents, userInputDto.RowSeparator);
            var headers        = _runService.GetHeaderRow(enrollmentRows);

            _runService.CleanCsv(enrollmentRows);
            _runService.ValidateRowLengths(enrollmentRows, headers.Count);
            var indexes     = _enrollmentService.GetIndexValues(headers);
            var enrollments = _runService.GetEnrollments(indexes, enrollmentRows);
            await _runService.CreateResponse(enrollments, userInputDto.OutputDirectory, cancellationToken);
        }