public void testImportValidData() { Jester dataCollector = new Jester(); Mock <FileContentImporter> mockImporter = new Mock <FileContentImporter>(); Ingester dataIngester = new Ingester(); dataIngester.Collector = dataCollector; dataIngester.Importer = mockImporter.Object; string[] data = new string[1]; DateTime expectedDate = new DateTime(2019, 10, 1); data[0] = "a,\"b,c\",1.0,2.0,3.0," + expectedDate + ",4.0"; string filePath = "abc.csv"; mockImporter.Setup(imp => imp.import(filePath)).Returns(data).Verifiable(); dataIngester.ingest(filePath); List <HistoricalPrecipitation> collector = dataCollector.PrecipitationHistory; Assert.IsNotEmpty(collector); Assert.IsTrue(collector.Count == 1); Assert.AreEqual(expectedDate, collector[0].RecordedDate); mockImporter.Verify(imp => imp.import(filePath), Times.Once); }
public PostIngestPipe(IngestOptions opt, Ingester filter_previ, ConcurrentQueue <string> msgs) { inMessages = msgs; localFilter = new Filter(opt.regexFilters, msgs); localDic = new Dictionarizer(localFilter.PieceTask, localFilter.outMessageStrings); localMark = new Markovizer(opt.gramSize, localDic.PieceTask, localDic.outSentenceBank); }
public MarkovPipe(IngestOptions opts) { ingestOptions = opts; localIngester = new Ingester(ingestOptions.infileCSV); workingPostIngestPipes = new Dictionary <ulong, PostIngestPipe>(); workingPostIngestInMsgs = new Dictionary <ulong, ConcurrentQueue <string> >(); Names = new Dictionary <ulong, string>(); }
public void Before_each_test() { _vcsRoots = new List<VcsRoot>(); _blockedPaths = new List<string>(); _blockedExtensions = new List<string>(); _documentStore = new EmbeddableDocumentStore { RunInMemory = true }.Initialize(); _tempWorkingFolder = Path.GetFullPath(Guid.NewGuid().ToString()); Directory.CreateDirectory(_tempWorkingFolder); _ingester = new Ingester(_documentStore); }
private Ingester IngestorFactory( IQueueClient queueClient = null, IConfig config = null, IWorkerRecordStoreService workerRecordStoreService = null, ICommandDispatcher commandDispatcher = null) { queueClient = CheckParam(queueClient); config = CheckParam(config); workerRecordStoreService = CheckParam(workerRecordStoreService); commandDispatcher = CheckParam(commandDispatcher); var ingester = new Ingester(queueClient, config, workerRecordStoreService, commandDispatcher); return(ingester); }
public void testImportNoData() { Jester dataCollector = new Jester(); Mock <FileContentImporter> mockImporter = new Mock <FileContentImporter>(); Ingester dataIngester = new Ingester(); dataIngester.Collector = dataCollector; dataIngester.Importer = mockImporter.Object; string[] data = new string[0]; string filePath = "abc.csv"; mockImporter.Setup(imp => imp.import(filePath)).Returns(data).Verifiable(); dataIngester.ingest(filePath); Assert.IsEmpty(dataCollector.PrecipitationHistory); mockImporter.Verify(imp => imp.import(filePath), Times.Once); }