public async void CanUpdateJobStatus() { var jobStatusStore = new JobStatusStore(Configuration.StorageConnectionString, Configuration.JobStatusContainerName); var jobId = Guid.NewGuid().ToString().Replace("-", String.Empty); var job = new JobStatus(); job.JobId = jobId; job.IsComplete = false; job.Message = "This is not complete."; await jobStatusStore.UpdateStatusAsync(job); var job1 = await jobStatusStore.ReadStatusAsync(jobId); Assert.False(job1.IsComplete); job.IsComplete = true; job.Message = "This is now complete!!!"; await jobStatusStore.UpdateStatusAsync(job); var job2 = await jobStatusStore.ReadStatusAsync(jobId); Assert.True(job2.IsComplete); }
public async Task ExecutesFullIntegrationPass() { var jobStatusStore = new JobStatusStore(Configuration.StorageConnectionString, Configuration.JobStatusContainerName); var blobReader = new AzureBlobReader(Configuration.StorageConnectionString, Configuration.FileUploadContainerName); var extractor = new TextFileContentExtractor(); var searchIndex = new AzureSearchIndex(Configuration.SearchServiceName, Configuration.SearchAdminKey); var docScorer = new TextDocumentScorer(searchIndex); var workflow = new ParsingWorkflow(jobStatusStore, blobReader, extractor, searchIndex, docScorer); var blobId = Guid.NewGuid().ToString().Replace("-", String.Empty); var jobId = Guid.NewGuid().ToString().Replace("-", String.Empty); var blobUri = String.Format("{0}/{1}", jobId, blobId); var blobDetails = new BlobDetails(); blobDetails.ContainerName = Configuration.FileUploadContainerName; blobDetails.FullBlobPath = blobUri; blobDetails.DocumentId = blobId; blobDetails.JobId = jobId; var job = new JobStatus(); job.OriginalFileName = "not-real-file.txt"; job.IsComplete = false; job.JobStartTime = DateTime.UtcNow; job.JobId = jobId; await jobStatusStore.UpdateStatusAsync(job); await createSampleBlob(blobUri); await workflow.ExecuteAsync(blobDetails); job = await jobStatusStore.ReadStatusAsync(jobId); var categoryCount = job.Categories.Length; Assert.Equal(1, categoryCount); Assert.Equal("Heavy Hitter", job.Categories[0]); }