public async Task ApproveManuallyAsync_ReturnsExpectedResult_DocumentTest() { //Arrange SetAsposeLicense(); var signer = $"hand and approved by ESFA"; string baseUrl = $"https://localhost:5001"; SetMapperHelper(); var contracts = GetDataModel_ForManualApprove(); var request = new ContractRequest() { ContractNumber = "main-0001", ContractVersion = 1, FileName = BlobHelper.BlobName }; ILoggerAdapter <ContractService> logger = new LoggerAdapter <ContractService>(new Logger <ContractService>(new LoggerFactory())); MockAuditService(); var contractRepo = await GetContractRepository(contracts); var uriService = new UriService(baseUrl); var asposeDocumentManagementContractService = GetDocumentService(); var contractValidationService = GetContractValidationService(); var mediator = BuildMediator(); var contractDocumentService = BuildContractDocumentService(); var service = new ContractService(contractRepo, _mapper, uriService, logger, _mockAuditService.Object, _semaphoreOnEntity, asposeDocumentManagementContractService, contractValidationService, mediator, contractDocumentService); //Act var beforeUpdate = await contractRepo.GetByContractNumberAndVersionWithIncludesAsync(request.ContractNumber, request.ContractVersion, ContractDataEntityInclude.Datas | ContractDataEntityInclude.Content); // assigning to a new variable before update because this is an in memory db the // update will update the object. var actualBeforeUpdate = GetClonedContract(beforeUpdate); var contract = await service.ApproveManuallyAsync(request); var afterUpdate = await contractRepo.GetByContractNumberAndVersionWithIncludesAsync(request.ContractNumber, request.ContractVersion, ContractDataEntityInclude.Datas); //Assert contract.Should().NotBeNull(); actualBeforeUpdate.Status.Should().Be((int)ContractStatus.PublishedToProvider); afterUpdate.Status.Should().Be((int)ContractStatus.Approved); afterUpdate.ContractContent.Content.ShouldHaveSignedPage("testDoc", signer, afterUpdate.SignedOn.Value, true, afterUpdate.ContractContent.FileName, ContractFundingType.CityDeals, null); afterUpdate.ContractData.OriginalContractXml.Should().Be(BlobHelper.BlobSampleContent); }