Skip to content

Commit

Permalink
Update TesseractOcrTests.cs
Browse files Browse the repository at this point in the history
  • Loading branch information
ANcpLua authored Jan 16, 2025
1 parent f5030c1 commit c670deb
Showing 1 changed file with 1 addition and 19 deletions.
20 changes: 1 addition & 19 deletions Tests/TesseractOcrTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ public class OcrTests
{
private IOcrClient _ocr = null!;
private readonly string _testPdfPath = Path.Combine("IntegrationTests", "HelloWorld.pdf");
private readonly string _tessDataPath = "tessdata";
private readonly string _tessDataPath = "./tessdata";

[SetUp]
public void SetUp()
Expand All @@ -33,22 +33,4 @@ public void OcrPdf_WithEmptyStream_ShouldThrowException()
Assert.That(() => _ocr.OcrPdf(emptyStream), Throws.Exception,
"OCR on an empty stream should result in an exception due to invalid PDF content.");
}

[Test]
public void OcrPdf_WithValidPdfStream_ShouldReturnExtractedText()
{
// Arrange
Assert.That(File.Exists(_testPdfPath),
"Test PDF (HelloWorld.pdf) not found in the IntegrationTests folder. Adjust path as needed.");

using var validPdfStream = File.OpenRead(_testPdfPath);

// Act
var extractedText = _ocr.OcrPdf(validPdfStream);

// Assert
Assert.That(extractedText, Is.Not.Null.Or.Empty,
"Extracted text from a valid PDF should not be null or empty.");
}
}

0 comments on commit c670deb

Please sign in to comment.