public void WriteToExportFileAsyncTest() { //Arrange var exportResultsRecords = GetExportResultsRecords(); //Act _exportFileCreator.WriteToExportFileAsync(exportResultsRecords).Wait(); //Assert var actualFileContents = ReadFileToEnd(); var expectedFileContents = ConstructExpectedFileContents(exportResultsRecords); Assert.That(actualFileContents, Is.EqualTo(expectedFileContents)); }
private async Task WriteResultsToExportFileAsync() { var exportResultsRecords = await QueryExportResults(AgentHelper.GetDBContext(-1), WorkspaceArtifactId, _markupUtilityExportJob.ArtifactId); while (exportResultsRecords.Count > 0) { //Loop through records and create export CSV file await _exportFileCreator.WriteToExportFileAsync(exportResultsRecords); //Delete selected Results records from Results table var recordIdList = exportResultsRecords.Select(x => x.Id).ToList(); await QueryHelper.DeleteExportResultsAsync(AgentHelper.GetDBContext(-1), recordIdList); //Check if any remaining results records exist exportResultsRecords = await QueryExportResults(AgentHelper.GetDBContext(-1), WorkspaceArtifactId, _markupUtilityExportJob.ArtifactId); } }