public void DocumentExtraction_ShouldReturnResult(DocumentExtractionPreset preset) => new DocumentExtraction { Document = _testData.GetFilePath(), TimeoutMS = (int)TimeSpan.FromMinutes(10).TotalMilliseconds, Preset = preset, } .Invoke() .Should() .StartWith("Our Google properties revenues");
public async Task <string> ExtractDocumentAsync(string filePath, DocumentExtractionPreset preset, CancellationToken cancellationToken) { var config = new JObject { { "preset_config", preset.ToString("F").ToLower() } }; var docExtraction = new DocumentExtraction(_indicoClientLegacy) { JsonConfig = config, }; var job = await docExtraction.Exec(filePath, cancellationToken); return(job.Id); }
public async Task GetExtractionResult_ShouldReturnDocument(DocumentExtractionPreset preset) { // Arrange var jobId = await _ocrClient.ExtractDocumentAsync(_dataHelper.Files().GetSampleFilePath(), preset); var jobResult = await _jobAwaiter.WaitReadyAsync <ExtractionJobResult>(jobId, TimeSpan.FromMilliseconds(300)); if (preset != DocumentExtractionPreset.OnDocument) { // Act var extractionResult = await _ocrClient.GetExtractionResultAsync(jobResult.Url); // Assert extractionResult.Should().NotBeNullOrEmpty(); } else { // Act var extractionResult = await _ocrClient.GetExtractionResultAsync <JArray>(jobResult.Url); // Assert extractionResult.Count.Should().Be(1); } }
public async Task ExtractDocument_ShouldReturnJobNumber(DocumentExtractionPreset preset) => (await _ocrClient.ExtractDocumentAsync(_dataHelper.Files().GetSampleFilePath(), preset, default))