public void Given_Valid_PdfFile_And_Pdf_Not_Allowed_Expect_SystemNotSupportedException() { var indexer = new TextUmbracoFileIndexer { SupportedExtensions = new[] { ".docx" } }; string wordFileToTest = Path.Combine(TestContext.CurrentContext.TestDirectory, TestHelper.PdfToTest); var ex = Assert.Throws <System.NotSupportedException>(() => indexer.Extract(wordFileToTest)); Assert.IsTrue(ex.Message.Contains("The file with the extension specified is not supported")); }
public void Given_Valid_File_ExpectExtractedContent() { var indexer = new TextUmbracoFileIndexer { SupportedExtensions = new[] { ".docx" } }; string wordFileToTest = Path.Combine(TestContext.CurrentContext.TestDirectory, TestHelper.DocToTest); string extractedText = indexer.Extract(wordFileToTest); Assert.IsTrue(extractedText.Contains("Current")); }
public void Given_Valid_File_ExpectMeta_After_Extraction() { var indexer = new TextUmbracoFileIndexer { SupportedExtensions = new[] { ".pdf" } }; string pdfFileToTest = Path.Combine(TestContext.CurrentContext.TestDirectory, TestHelper.PdfToTest); indexer.Extract(pdfFileToTest); var metaData = indexer.ExtractedMetaFromTika; Assert.AreEqual(metaData["dc:creator"], "Dragana"); }