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]);
        }
        public async void CanReadMultipleJobDetails()
        {
            var jobStatusStore = new JobStatusStore(Configuration.StorageConnectionString, Configuration.JobStatusContainerName);
            var jobCount       = 10;
            var jobs           = new Dictionary <string, JobStatus>();

            for (var i = 0; i < jobCount; i++)
            {
                var jobId = Guid.NewGuid().ToString().Replace("-", String.Empty);
                var job   = new JobStatus();
                job.JobId            = jobId;
                job.OriginalFileName = $"Some_file_{i}.txt";
                job.IsComplete       = false;
                job.JobStartTime     = DateTime.UtcNow;
                job.JobEndTime       = DateTime.UtcNow.AddMinutes(5);
                job.Message          = $"This is job {i}";
                job.Categories       = new[] { "category1", "category2", "category3" };
                await jobStatusStore.UpdateStatusAsync(job);

                jobs.Add(jobId, job);
            }

            var listedJobs = await jobStatusStore.ReadAllStatusAsync();

            foreach (var listItem in listedJobs)
            {
                var matchingStatus = jobs[listItem.JobId];
                Assert.Equal(listItem.JobId, matchingStatus.JobId);
                Assert.Equal(listItem.OriginalFileName, matchingStatus.OriginalFileName);
                Assert.Equal(listItem.IsComplete, matchingStatus.IsComplete);
                Assert.Equal(listItem.Message, matchingStatus.Message);
                Assert.Equal(listItem.JobStartTime, matchingStatus.JobStartTime);
                Assert.Equal(listItem.JobEndTime, matchingStatus.JobEndTime);
                Assert.Equal(listItem.Categories[0], matchingStatus.Categories[0]);
                Assert.Equal(listItem.Categories[1], matchingStatus.Categories[1]);
                Assert.Equal(listItem.Categories[2], matchingStatus.Categories[2]);
            }
        }
        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);
        }