public async Task <bool> CreateDocumentUploadHistory(DocumentUploadHistoryDetails model)
        {
            if (model != null)
            {
                var tlAwardingOrganisation = await _tlAwardingOrganisationRepository.GetFirstOrDefaultAsync(x => x.UkPrn == model.AoUkprn);

                if (tlAwardingOrganisation == null)
                {
                    _logger.LogWarning(LogEvent.NoDataFound, $"TlAwardingOrganisationId not found for AoUkprn = {model.AoUkprn}. Method: CreateDocumentUploadHistory()");
                    return(false);
                }
                model.TlAwardingOrganisationId = tlAwardingOrganisation.Id;
                var entityModel = _mapper.Map <DocumentUploadHistory>(model);
                return(await _documentUploadHistoryRepository.CreateAsync(entityModel) > 0);
            }
            return(false);
        }
        public override void Given()
        {
            BlobUniqueReference = Guid.NewGuid();
            ApiResponse         = new DocumentUploadHistoryDetails
            {
                AoUkprn             = Ukprn,
                BlobFileName        = BlobFileName,
                BlobUniqueReference = BlobUniqueReference,
                DocumentType        = (int)DocumentType.Results,
                FileType            = (int)FileType.Csv,
                Status    = (int)DocumentUploadStatus.Processed,
                CreatedBy = $"{Givenname} {Surname}"
            };

            InternalApiClient.GetDocumentUploadHistoryDetailsAsync(Ukprn, BlobUniqueReference).Returns(ApiResponse);
            BlobStorageService.DownloadFileAsync(Arg.Any <BlobStorageData>()).Returns(new MemoryStream(Encoding.ASCII.GetBytes("Test File")));
            Loader = new ResultLoader(Mapper, Logger, InternalApiClient, BlobStorageService);
        }
        public async Task <bool> CreateDocumentUploadHistory(BulkProcessRequest request, DocumentUploadStatus status = DocumentUploadStatus.Processed)
        {
            if (request == null)
            {
                return(false);
            }

            var model = new DocumentUploadHistoryDetails
            {
                AoUkprn             = request.AoUkprn,
                BlobFileName        = request.BlobFileName,
                BlobUniqueReference = request.BlobUniqueReference,
                DocumentType        = (int)request.DocumentType,
                FileType            = (int)request.FileType,
                Status    = (int)status,
                CreatedBy = request.PerformedBy
            };

            return(await _documentUploadHistoryService.CreateDocumentUploadHistory(model));
        }
Exemple #4
0
        public override void Setup()
        {
            _tokenServiceClient = Substitute.For <ITokenServiceClient>();

            _configuration = new ResultsAndCertificationConfiguration
            {
                ResultsAndCertificationInternalApiSettings = new ResultsAndCertificationInternalApiSettings {
                    Uri = "http://tlevel.api.com"
                }
            };

            _mockHttpResult = new DocumentUploadHistoryDetails
            {
                TlAwardingOrganisationId = 1,
                AoUkprn             = _ukprn,
                BlobUniqueReference = Guid.NewGuid(),
                BlobFileName        = "inputfile.csv",
                DocumentType        = (int)DocumentType.Registrations,
                FileType            = (int)FileType.Csv,
                Status = (int)BulkProcessStatus.Processed
            };
        }
Exemple #5
0
 public async override Task When()
 {
     Result = await _apiClient.GetDocumentUploadHistoryDetailsAsync(_ukprn, _blobUniqueReference);
 }