public void Must_pdf_to_text_be_called_first() { const string textExpected = "Text"; A.CallTo(() => _pdfToText.Exctract(FilePath, Page)).Returns(textExpected); var text = _manager.Extract(FilePath, Page).Result; Assert.Equal(textExpected, text); }
private void ExtractGameDir(string containerPath, string versionFilePath, string gamePath) { ExtractionManager ex = new ExtractionManager(new List <Extractor>() { new PackageExtractor(), new FileExtractor() }); RootDirectoryEntity deser = new RootDirectoryEntityIO().Deserialize(versionFilePath); ex.Extract(deser, gamePath, Helpers.EntityToPath(containerPath), _dirCache, null); }
public void ExtractToContainer(RootDirectoryEntity root, string gameDir, IProgress <int> progress) { string container = Settings.Default.ContainerDirectory; ExtractionManager ex = new ExtractionManager(new List <Extractor>() { new PackageExtractor(), new FileExtractor() }); ex.Extract(root, gameDir, Helpers.EntityToPath(container), _dirCache, progress); string cacheXml = Settings.Default.DirectoryCacheFile; _ds.Serialize(_dirCache, cacheXml); }
public void Must_process_all_pages_from_document() { const string filePath = "file.pdf"; const int numberOfPages = 2; const string pageText1 = "Text 1"; const string pageText2 = "Text 2"; A.CallTo(() => _fileManager.Download(_newFileToProcess.Url)).Returns(filePath); A.CallTo(() => _fileManager.GetNumberOfPages(filePath)).Returns(numberOfPages); A.CallTo(() => _extractionManager.Extract(filePath, 1)).Returns(pageText1); A.CallTo(() => _extractionManager.Extract(filePath, 2)).Returns(pageText2); _processDocument.Process(_newFileToProcess).Wait(); A.CallTo(() => _callback.Send( A <DocumentResultResponse> .That.Matches(d => d.Pages.Count == numberOfPages), _newFileToProcess.CallbackUrl)); A.CallTo(() => _callback.Send( A <DocumentResultResponse> .That.Matches(d => d.Pages[0].Text == pageText1), _newFileToProcess.CallbackUrl)); A.CallTo(() => _callback.Send( A <DocumentResultResponse> .That.Matches(d => d.Pages[1].Text == pageText2), _newFileToProcess.CallbackUrl)); }