Exemple #1
0
        public void issue_81_file_1()
        {
            var filePath = _filePathParent + "sad-files/EI-73-1018-2_5632837.doc";

            Action act = () => _cut.Parse(filePath);

            act.Should().Throw <TextExtractionException>();

            //act.ShouldThrow<TextExtractionException>();
        }
Exemple #2
0
        public void ParallelTestWithLokalParser()
        {
            var plist = new List <KeyValuePair <string, string> >();

            var list = new List <KeyValuePair <string, string> >();

            list.Add(new KeyValuePair <string, string>(_filePathParent + "files/Tika.pptx", "Tika Test Presentation"));
            list.Add(new KeyValuePair <string, string>(_filePathParent + "files/Tika.docx", "formatted in interesting ways"));
            list.Add(new KeyValuePair <string, string>(_filePathParent + "files/Tika.xlsx", "Use the force duke"));

            for (int i = 0; i < 1000; i++)
            {
                plist.AddRange(list);
            }

            Parallel.ForEach(plist, (test) =>
            {
                var tika2  = new Tika();
                var result = tika2.Parse(test.Key);
                result.Text.Should().Contain(test.Value);

                var result2 = tika.ParseToString(test.Key);
                result2.Should().Contain(test.Value);
            });
        }
        public void StreamParsing()
        {
            string filePath = _filePathParent + "files/Tika.rtf";

            using (FileStream fileStream = new FileStream(filePath, FileMode.Open, FileAccess.Read))
            {
                var result = tika.Parse(fileStream);

                result.Text.Should().Contain("pack of pickled almonds");
            }
        }
Exemple #4
0
        public void should_extract_author_list_from_pdf()
        {
            var textExtractionResult = _cut.Parse(_filePathParent + "files/file_author.pdf", CreateCustomResult);

            textExtractionResult.Metadata["meta:author"].Should().ContainInOrder("Bernal, M. A.", "deAlmeida, C. E.", "Incerti, S.", "Champion, C.", "Ivanchenko, V.", "Francis, Z.");
        }
        public void non_existing_files_should_fail_with_exception()
        {
            string fileName = _filePathParent + "files/doesnotexist.mp3";


            Action act = () => _cut.Parse(fileName);

            act.Should().Throw <TextExtractionException>().Which.Message.Should().Contain(fileName);

            //act.ShouldThrow<TextExtractionException>()
            //    .Which.Message.Should().Contain(fileName);
        }