Пример #1
0
        public async Task ExecuteAsync(IEasJobContext easJobContext, CancellationToken cancellationToken)
        {
            _logger.LogInfo("Validate Task is called.");

            try
            {
                var validationErrorReferenceData = await _validationErrorRuleService.GetAllValidationErrorRules(cancellationToken);

                var fileValidationErrors = await _fileValidationService.ValidateFile(easJobContext, validationErrorReferenceData, cancellationToken);

                if (fileValidationErrors.Any())
                {
                    return;
                }

                cancellationToken.ThrowIfCancellationRequested();

                await _validationService.ValidateDataAsync(easJobContext, validationErrorReferenceData, cancellationToken);
            }
            catch (Exception ex)
            {
                _logger.LogError("Failed to validate data", ex);
                throw;
            }
        }
Пример #2
0
        public async Task UploadFile(FilePayload filePayload)
        {
            await dataStoreService.UploadFile(filePayload);

            fileDownloadDatabaseService.FileDownloadFinished(filePayload);

            try
            {
                fileDownloadDatabaseService.FileValidationStarted(filePayload);
                fileValidationService.ValidateFile(filePayload);
                fileDownloadDatabaseService.FileValidated(filePayload);
            }
            catch (FileDownloadFailedDecompressionException)
            {
                throw;
            }
            catch (InvalidStatsFileException)
            {
                throw;
            }
            catch (Exception exception)
            {
                throw new UnexpectedValidationException(exception);
            }
        }
        private async Task <ParseResults> GetValidatedFile(ValidatedFile validatedFile)
        {
            loggingService.LogMethodInvoked();
            var filePayload = new FilePayload();

            filePayloadApiSettingsService.SetFilePayloadApiSettings(filePayload);
            await dataStoreService.DownloadFile(filePayload, validatedFile);

            ParseResults results = fileValidationService.ValidateFile(filePayload);

            loggingService.LogMethodFinished();
            return(results);
        }
        public void UploadFile_WhenInvoked_UploadsFile()
        {
            InvokeUploadFile();

            Received.InOrder(() =>
            {
                dataStoreServiceMock.UploadFile(filePayload);
                fileDownloadDatabaseServiceMock.FileDownloadFinished(filePayload);
                fileDownloadDatabaseServiceMock.FileValidationStarted(filePayload);
                fileValidationServiceMock.ValidateFile(filePayload);
                fileDownloadDatabaseServiceMock.FileValidated(filePayload);
            });
        }
Пример #5
0
        public void ValidateFile_WhenInvoked_ReturnsValidationResults()
        {
            ParseResults actual = systemUnderTest.ValidateFile(filePayloadMock);

            Assert.That(actual, Is.EqualTo(parseResultsMock));
        }