Exemple #1
0
        public void Import_Succeeds()
        {
            string dbFilePath     = @$ "{nameof(LogEventArchiver)}_{Guid.NewGuid().ToString(" N ")}.db";
            string collectionName = "ServerEvents";

            LiteDbQueryManager.ClearCollection <ServerEvent>(dbFilePath, collectionName, s => true);

            int maxReaderThreads = 16;
            var events           = this.getGeneratedServerEventsCollection();
            int eventCount       = events.Count;

            var sut          = new LogEventLiteDbImporter(maxReaderThreads, dbFilePath);
            var returnedTask = sut.Import(events);

            Task.WaitAll(returnedTask);

            var srvEvtDocs = LiteDbQueryManager.GetDocuments <ServerEvent>(dbFilePath, collectionName, s => true);

            Assert.Equal(eventCount, srvEvtDocs.Count());
        }
        public void Run_Succeeds()
        {
            string logFilePath = "TestFiles\\LogFileReader_Test_Data.txt";
            var    reader      = new LogFileReader(logFilePath, 4L);

            string dbFilePath     = @$ "{nameof(LogEventArchiver)}_{Guid.NewGuid().ToString(" N ")}.db";
            string collectionName = "ServerEvents";

            LiteDbQueryManager.ClearCollection <ServerEvent>(dbFilePath, collectionName, s => true);

            int maxReaderThreads = 16;
            var importer         = new LogEventLiteDbImporter(maxReaderThreads, dbFilePath);

            var sut = new Processor(reader, importer);

            sut.Run();

            var srvEvtDocs = LiteDbQueryManager.GetDocuments <ServerEvent>(dbFilePath, collectionName, s => true);

            Assert.NotEmpty(srvEvtDocs);
        }