Ejemplo n.º 1
0
        public void can_get_specific_log()
        {
            var luceneConfiguration = new LuceneConfiguration
            {
                MaxSearch = 10,
                Path      = Path.Combine(TestHelper.GetTestLogDirectory(), "Lucene"),
                OpenMode  = OpenMode.CREATE,
                Directory = ""
            };

            var directory = Assembly.GetExecutingAssembly().GetName().Name;

            var searcherService = new LuceneSearcherService(luceneConfiguration);

            var result = searcherService.GetLogWithFilters(null, new DateTime(2, 01, 01), new DateTime(9999, 01, 01), new[] { "LogLevel", "Text" }, new[] { "Info" }, "Text:\"Hello world\"", new[] { directory }, 0);

            result.Should().NotBeNull();
            result.Count.Should().Be(1);
            result[0].LogType.Should().Be(ELogType.Line);

            var log = result[0] as LineViewModel;

            log.Text.Should().Be("Hello world");
            log.LogLevel.Should().Contain("Info");
        }
Ejemplo n.º 2
0
        public void log_can_be_search()
        {
            var luceneConfiguration = new LuceneConfiguration
            {
                MaxSearch = 10,
                Path      = Path.Combine(TestHelper.GetTestLogDirectory(), "Lucene"),
                OpenMode  = OpenMode.CREATE,
                Directory = ""
            };
            var directory = Assembly.GetExecutingAssembly().GetName().Name;

            var searcherService = new LuceneSearcherService(luceneConfiguration);

            var result = searcherService.Search("Text:\"Hello world\"", directory);

            result.Should().NotBeNull();
            result.Count.Should().Be(1);
            result[0].LogType.Should().Be(ELogType.Line);

            var log = result[0] as LineViewModel;

            log.Text.Should().Be("Hello world");
            log.LogLevel.Should().Contain("Info");

            result = searcherService.Search("Text:\"CriticalError\"", directory);
            result.Should().NotBeNull();
            result.Count.Should().Be(1);
            result[0].LogType.Should().Be(ELogType.Line);

            log = result[0] as LineViewModel;
            log.Text.Should().Be("CriticalError");
            log.LogLevel.Should().Contain("Error");
        }
Ejemplo n.º 3
0
        public void can_get_monitor_id_list()
        {
            var luceneConfiguration = new LuceneConfiguration
            {
                MaxSearch = 10,
                Path      = Path.Combine(TestHelper.GetTestLogDirectory(), "Lucene"),
                OpenMode  = OpenMode.CREATE,
                Directory = ""
            };

            var searcherService = new LuceneSearcherService(luceneConfiguration);

            var result = searcherService.GetMonitorIdList();

            result.Should().NotBeNull();
            result.Count.Should().BeGreaterThan(0);
        }
Ejemplo n.º 4
0
        public void can_get_all_appName()
        {
            var luceneConfiguration = new LuceneConfiguration
            {
                MaxSearch = 10,
                Path      = Path.Combine(TestHelper.GetTestLogDirectory(), "Lucene"),
                OpenMode  = OpenMode.CREATE,
                Directory = ""
            };

            var searcherService = new LuceneSearcherService(luceneConfiguration);

            var result = searcherService.GetAppNameList();

            result.Should().NotBeNull();
            result.Count.Should().BeGreaterThan(0);
            result.Should().Contain(Assembly.GetExecutingAssembly().GetName().Name);
        }
Ejemplo n.º 5
0
        public void can_get_all_logs()
        {
            var luceneConfiguration = new LuceneConfiguration
            {
                MaxSearch = 10,
                Path      = Path.Combine(TestHelper.GetTestLogDirectory(), "Lucene"),
                OpenMode  = OpenMode.CREATE,
                Directory = ""
            };

            var directory = Assembly.GetExecutingAssembly().GetName().Name;

            var searcherService = new LuceneSearcherService(luceneConfiguration);

            var result = searcherService.GetAll(new[] { directory });

            result.Should().NotBeNull();
            result.Count.Should().Be(LuceneTestIndexBuilder.TotalLogCount);
        }