Esempio n. 1
0
        public void TestSingleLine7()
        {
            var filter = new OrFilter(new[] { new SubstringFilter("foo", false), new SubstringFilter("bar", false) });

            filter.PassesFilter(new LogEntry(Core.Columns.RawContent)
            {
                RawContent = "FOOBAR"
            }).Should().BeFalse();
        }
Esempio n. 2
0
        public void TestMultiLine2()
        {
            var filter = new OrFilter(new[] { new SubstringFilter("foo", true) });
            var lines  = new[]
            {
                new LogLine(0, 0, "fo", LevelFlags.All),
                new LogLine(0, 0, "obar", LevelFlags.All)
            };

            filter.PassesFilter(lines).Should().BeFalse("because substring filters shouldn't be matched across lines");
        }
Esempio n. 3
0
        public void TestMultiLine1()
        {
            var filter = new OrFilter(new[] { new SubstringFilter("foo", true) });
            var lines  = new[]
            {
                new LogLine(0, 0, "bar", LevelFlags.All),
                new LogLine(0, 0, "foo", LevelFlags.All)
            };

            filter.PassesFilter(lines).Should().BeTrue("because it should be enough to have a hit on one line of a multi line entry");
        }
Esempio n. 4
0
        public void TestSingleLine3()
        {
            var filter = new OrFilter(new[] { new SubstringFilter("foo", true) });
            var line   = new LogLine(0, 0, "bar", LevelFlags.All);

            filter.PassesFilter(line).Should().BeFalse();
            var matches = filter.Match(line);

            matches.Should().NotBeNull();
            matches.Should().BeEmpty();
        }
Esempio n. 5
0
        public void TestSingleLine3()
        {
            var filter = new OrFilter(new[] { new SubstringFilter("foo", true) });
            var line   = new LogEntry(Core.Columns.RawContent)
            {
                RawContent = "bar"
            };

            filter.PassesFilter(line).Should().BeFalse();
            var matches = filter.Match(line);

            matches.Should().NotBeNull();
            matches.Should().BeEmpty();
        }
Esempio n. 6
0
        public void TestMultiLine2()
        {
            var filter = new OrFilter(new[] { new SubstringFilter("foo", true) });
            var lines  = new[]
            {
                new LogEntry(Core.Columns.RawContent)
                {
                    RawContent = "fo"
                },
                new LogEntry(Core.Columns.RawContent)
                {
                    RawContent = "obar"
                }
            };

            filter.PassesFilter(lines).Should().BeFalse("because substring filters shouldn't be matched across lines");
        }
Esempio n. 7
0
        public void TestMultiLine1()
        {
            var filter = new OrFilter(new[] { new SubstringFilter("foo", true) });
            var lines  = new[]
            {
                new LogEntry(Core.Columns.RawContent)
                {
                    RawContent = "bar"
                },
                new LogEntry(Core.Columns.RawContent)
                {
                    RawContent = "foo"
                }
            };

            filter.PassesFilter(lines).Should().BeTrue("because it should be enough to have a hit on one line of a multi line entry");
        }
Esempio n. 8
0
        public void TestSingleLine7()
        {
            var filter = new OrFilter(new[] { new SubstringFilter("foo", false), new SubstringFilter("bar", false) });

            filter.PassesFilter(new LogLine(0, 0, "FOOBAR", LevelFlags.All)).Should().BeFalse();
        }