Esempio n. 1
0
        public void TestFilteringAndClear()
        {
            MockConsole console = new MockConsole();

            console.Add(CLogLevel.Debug, tag, "line1");
            console.Add(CLogLevel.Debug, tag, "line11");
            console.Add(CLogLevel.Debug, tag, "line111");
            console.Add(CLogLevel.Debug, tag, "line1111");
            console.Add(CLogLevel.Debug, tag, "foo");

            MockConsoleView consoleView = new MockConsoleView(console, 320, 230);

            consoleView.SetFilterText("line111");
            Assert.IsTrue(consoleView.IsFiltering);
            AssertVisibleRows(consoleView, "line111", "line1111");

            console.Clear();
            Assert.IsTrue(consoleView.IsFiltering);
            AssertVisibleRows(consoleView);

            console.Add(CLogLevel.Debug, tag, "line12");
            console.Add(CLogLevel.Debug, tag, "line112");
            console.Add(CLogLevel.Debug, tag, "line1112");
            console.Add(CLogLevel.Debug, tag, "line11112");
            console.Add(CLogLevel.Debug, tag, "foo2");

            Assert.IsTrue(consoleView.IsFiltering);
            AssertVisibleRows(consoleView, "line1112", "line11112");

            consoleView.SetFilterText("");
            Assert.IsFalse(consoleView.IsFiltering);
            AssertVisibleRows(consoleView, "line12", "line112", "line1112", "line11112", "foo2");
        }
        public void TestMixedFiltersTextLevelTag()
        {
            Tag tag1 = new Tag("tag1");
            Tag tag2 = new Tag("tag2");
            Tag tag3 = new Tag("tag3");

            MockConsole console = new MockConsole(64);

            console.Add(LogLevel.Exception, tag1, "tog1-exception");
            console.Add(LogLevel.Exception, tag1, "tag1-exception");

            console.Add(LogLevel.Error, tag2, "tog2-error");
            console.Add(LogLevel.Error, tag2, "tag2-error");

            console.Add(LogLevel.Warn, tag3, "tog3-warning");
            console.Add(LogLevel.Warn, tag3, "tag3-warning");

            console.Add(LogLevel.Info, tag1, "tog1-info");
            console.Add(LogLevel.Info, tag1, "tag1-info");

            console.Add(LogLevel.Debug, tag2, "tog2-debug");
            console.Add(LogLevel.Debug, tag2, "tag2-debug");

            console.Add(LogLevel.Verbose, tag3, "tog3-verbose");
            console.Add(LogLevel.Verbose, tag3, "tag3-verbose");

            MockConsoleView consoleView = new MockConsoleView(console, 320, 230);

            consoleView.SetFilterText("tag");
            Assert.IsTrue(consoleView.IsFiltering);

            AssertVisibleRows(consoleView,
                "tag1-exception",
                "tag2-error",
                "tag3-warning",
                "tag1-info",
                "tag2-debug",
                "tag3-verbose"
            );

            consoleView.SetFilterLogLevel(LogLevel.Warn);
            Assert.IsTrue(consoleView.IsFiltering);

            AssertVisibleRows(consoleView,
                "tag1-exception",
                "tag2-error",
                "tag3-warning"
            );

            consoleView.SetFilterTags(tag1, tag3);
            Assert.IsTrue(consoleView.IsFiltering);

            AssertVisibleRows(consoleView,
                "tag1-exception",
                "tag3-warning"
            );

            consoleView.SetFilterText("");
            Assert.IsTrue(consoleView.IsFiltering);

            AssertVisibleRows(consoleView,
                "tog1-exception",
                "tag1-exception",
                "tog3-warning",
                "tag3-warning"
            );

            consoleView.SetFilterTags();
            Assert.IsTrue(consoleView.IsFiltering);

            AssertVisibleRows(consoleView,
                "tog1-exception",
                "tag1-exception",
                "tog2-error",
                "tag2-error",
                "tog3-warning",
                "tag3-warning"
            );

            consoleView.SetFilterLogLevel(LogLevel.Verbose);
            Assert.IsFalse(consoleView.IsFiltering);

            AssertVisibleRows(consoleView,
                "tog1-exception",
                "tag1-exception",
                "tog2-error",
                "tag2-error",
                "tog3-warning",
                "tag3-warning",
                "tog1-info",
                "tag1-info",
                "tog2-debug",
                "tag2-debug",
                "tog3-verbose",
                "tag3-verbose"
            );
        }
        public void TestFilteringAndClear()
        {
            MockConsole console = new MockConsole();
            console.Add(LogLevel.Debug, tag, "line1");
            console.Add(LogLevel.Debug, tag, "line11");
            console.Add(LogLevel.Debug, tag, "line111");
            console.Add(LogLevel.Debug, tag, "line1111");
            console.Add(LogLevel.Debug, tag, "foo");

            MockConsoleView consoleView = new MockConsoleView(console, 320, 230);

            consoleView.SetFilterText("line111");
            Assert.IsTrue(consoleView.IsFiltering);
            AssertVisibleRows(consoleView, "line111", "line1111");

            console.Clear();
            Assert.IsTrue(consoleView.IsFiltering);
            AssertVisibleRows(consoleView);

            console.Add(LogLevel.Debug, tag, "line12");
            console.Add(LogLevel.Debug, tag, "line112");
            console.Add(LogLevel.Debug, tag, "line1112");
            console.Add(LogLevel.Debug, tag, "line11112");
            console.Add(LogLevel.Debug, tag, "foo2");

            Assert.IsTrue(consoleView.IsFiltering);
            AssertVisibleRows(consoleView, "line1112", "line11112");

            consoleView.SetFilterText("");
            Assert.IsFalse(consoleView.IsFiltering);
            AssertVisibleRows(consoleView, "line12", "line112", "line1112", "line11112", "foo2");
        }
        public void TestFilterAndOverflow()
        {
            MockConsole console = new MockConsole(10);
            console.Add(LogLevel.Debug, tag, "a1");
            console.Add(LogLevel.Debug, tag, "a2");
            console.Add(LogLevel.Debug, tag, "a3");
            console.Add(LogLevel.Debug, tag, "a4");
            console.Add(LogLevel.Debug, tag, "b1");
            console.Add(LogLevel.Debug, tag, "b2");

            MockConsoleView consoleView = new MockConsoleView(console, 320, 230);

            consoleView.SetFilterText("a");
            AssertVisibleRows(consoleView, "a1", "a2", "a3", "a4");

            console.Add(LogLevel.Debug, tag, "b3");
            AssertVisibleRows(consoleView, "a1", "a2", "a3", "a4");

            console.Add(LogLevel.Debug, tag, "a5");
            AssertVisibleRows(consoleView, "a1", "a2", "a3", "a4", "a5");

            console.Add(LogLevel.Debug, tag, "b4");
            AssertVisibleRows(consoleView, "a1", "a2", "a3", "a4", "a5");

            console.Add(LogLevel.Debug, tag, "a6");
            AssertVisibleRows(consoleView, "a1", "a2", "a3", "a4", "a5", "a6");

            console.Add(LogLevel.Debug, tag, "b5");
            AssertVisibleRows(consoleView, "a2", "a3", "a4", "a5", "a6");

            console.Add(LogLevel.Debug, tag, "b6");
            AssertVisibleRows(consoleView, "a3", "a4", "a5", "a6");

            console.Add(LogLevel.Debug, tag, "a7");
            AssertVisibleRows(consoleView, "a4", "a5", "a6", "a7");

            console.Add(LogLevel.Debug, tag, "a8");
            AssertVisibleRows(consoleView, "a5", "a6", "a7", "a8");

            console.Add(LogLevel.Debug, tag, "a9");
            AssertVisibleRows(consoleView, "a5", "a6", "a7", "a8", "a9");

            console.Add(LogLevel.Debug, tag, "b7");
            AssertVisibleRows(consoleView, "a5", "a6", "a7", "a8", "a9");

            console.Add(LogLevel.Debug, tag, "b8");
            AssertVisibleRows(consoleView, "a5", "a6", "a7", "a8", "a9");

            console.Add(LogLevel.Debug, tag, "a10");
            AssertVisibleRows(consoleView, "a6", "a7", "a8", "a9", "a10");

            console.Add(LogLevel.Debug, tag, "b9");
            AssertVisibleRows(consoleView, "a6", "a7", "a8", "a9", "a10");

            console.Add(LogLevel.Debug, tag, "b10");
            AssertVisibleRows(consoleView, "a7", "a8", "a9", "a10");

            console.Add(LogLevel.Debug, tag, "b11");
            AssertVisibleRows(consoleView, "a7", "a8", "a9", "a10");

            console.Add(LogLevel.Debug, tag, "b12");
            AssertVisibleRows(consoleView, "a7", "a8", "a9", "a10");

            console.Add(LogLevel.Debug, tag, "b13");
            AssertVisibleRows(consoleView, "a8", "a9", "a10");

            console.Add(LogLevel.Debug, tag, "b14");
            AssertVisibleRows(consoleView, "a9", "a10");

            console.Add(LogLevel.Debug, tag, "b15");
            AssertVisibleRows(consoleView, "a10");

            console.Add(LogLevel.Debug, tag, "b16");
            AssertVisibleRows(consoleView, "a10");

            console.Add(LogLevel.Debug, tag, "b17");
            AssertVisibleRows(consoleView, "a10");

            console.Add(LogLevel.Debug, tag, "b18");
            AssertVisibleRows(consoleView);

            console.Add(LogLevel.Debug, tag, "a11");
            AssertVisibleRows(consoleView, "a11");

            console.Add(LogLevel.Debug, tag, "b19");
            AssertVisibleRows(consoleView, "a11");

            console.Add(LogLevel.Debug, tag, "a12");
            AssertVisibleRows(consoleView, "a11", "a12");

            consoleView.SetFilterText("");
            AssertVisibleRows(consoleView, "b12", "b13", "b14", "b15", "b16", "b17", "b18", "a11", "b19", "a12");
        }
Esempio n. 5
0
        public void TestMixedFiltersTagLevelText()
        {
            CTag tag1 = new CTag("tag1");
            CTag tag2 = new CTag("tag2");
            CTag tag3 = new CTag("tag3");

            MockConsole console = new MockConsole(64);

            console.Add(CLogLevel.Exception, tag1, "tog1-exception");
            console.Add(CLogLevel.Exception, tag1, "tag1-exception");

            console.Add(CLogLevel.Error, tag2, "tog2-error");
            console.Add(CLogLevel.Error, tag2, "tag2-error");

            console.Add(CLogLevel.Warn, tag3, "tog3-warning");
            console.Add(CLogLevel.Warn, tag3, "tag3-warning");

            console.Add(CLogLevel.Info, tag1, "tog1-info");
            console.Add(CLogLevel.Info, tag1, "tag1-info");

            console.Add(CLogLevel.Debug, tag2, "tog2-debug");
            console.Add(CLogLevel.Debug, tag2, "tag2-debug");

            console.Add(CLogLevel.Verbose, tag3, "tog3-verbose");
            console.Add(CLogLevel.Verbose, tag3, "tag3-verbose");

            MockConsoleView consoleView = new MockConsoleView(console, 320, 230);

            consoleView.SetFilterTags(tag1, tag3);
            Assert.IsTrue(consoleView.IsFiltering);

            AssertVisibleRows(consoleView,
                              "tog1-exception",
                              "tag1-exception",
                              "tog3-warning",
                              "tag3-warning",
                              "tog1-info",
                              "tag1-info",
                              "tog3-verbose",
                              "tag3-verbose"
                              );

            consoleView.SetFilterLogLevel(CLogLevel.Warn);
            Assert.IsTrue(consoleView.IsFiltering);

            AssertVisibleRows(consoleView,
                              "tog1-exception",
                              "tag1-exception",
                              "tog3-warning",
                              "tag3-warning"
                              );

            consoleView.SetFilterText("tag");
            Assert.IsTrue(consoleView.IsFiltering);

            AssertVisibleRows(consoleView,
                              "tag1-exception",
                              "tag3-warning"
                              );

            consoleView.SetFilterLogLevel(CLogLevel.Verbose);
            Assert.IsTrue(consoleView.IsFiltering);

            AssertVisibleRows(consoleView,
                              "tag1-exception",
                              "tag3-warning",
                              "tag1-info",
                              "tag3-verbose"
                              );

            consoleView.SetFilterTags();
            Assert.IsTrue(consoleView.IsFiltering);

            AssertVisibleRows(consoleView,
                              "tag1-exception",
                              "tag2-error",
                              "tag3-warning",
                              "tag1-info",
                              "tag2-debug",
                              "tag3-verbose"
                              );

            consoleView.SetFilterText("");
            Assert.IsFalse(consoleView.IsFiltering);

            AssertVisibleRows(consoleView,
                              "tog1-exception",
                              "tag1-exception",
                              "tog2-error",
                              "tag2-error",
                              "tog3-warning",
                              "tag3-warning",
                              "tog1-info",
                              "tag1-info",
                              "tog2-debug",
                              "tag2-debug",
                              "tog3-verbose",
                              "tag3-verbose"
                              );
        }
Esempio n. 6
0
        public void TestFilterAndOverflow()
        {
            MockConsole console = new MockConsole(10);

            console.Add(CLogLevel.Debug, tag, "a1");
            console.Add(CLogLevel.Debug, tag, "a2");
            console.Add(CLogLevel.Debug, tag, "a3");
            console.Add(CLogLevel.Debug, tag, "a4");
            console.Add(CLogLevel.Debug, tag, "b1");
            console.Add(CLogLevel.Debug, tag, "b2");

            MockConsoleView consoleView = new MockConsoleView(console, 320, 230);

            consoleView.SetFilterText("a");
            AssertVisibleRows(consoleView, "a1", "a2", "a3", "a4");

            console.Add(CLogLevel.Debug, tag, "b3");
            AssertVisibleRows(consoleView, "a1", "a2", "a3", "a4");

            console.Add(CLogLevel.Debug, tag, "a5");
            AssertVisibleRows(consoleView, "a1", "a2", "a3", "a4", "a5");

            console.Add(CLogLevel.Debug, tag, "b4");
            AssertVisibleRows(consoleView, "a1", "a2", "a3", "a4", "a5");

            console.Add(CLogLevel.Debug, tag, "a6");
            AssertVisibleRows(consoleView, "a1", "a2", "a3", "a4", "a5", "a6");

            console.Add(CLogLevel.Debug, tag, "b5");
            AssertVisibleRows(consoleView, "a2", "a3", "a4", "a5", "a6");

            console.Add(CLogLevel.Debug, tag, "b6");
            AssertVisibleRows(consoleView, "a3", "a4", "a5", "a6");

            console.Add(CLogLevel.Debug, tag, "a7");
            AssertVisibleRows(consoleView, "a4", "a5", "a6", "a7");

            console.Add(CLogLevel.Debug, tag, "a8");
            AssertVisibleRows(consoleView, "a5", "a6", "a7", "a8");

            console.Add(CLogLevel.Debug, tag, "a9");
            AssertVisibleRows(consoleView, "a5", "a6", "a7", "a8", "a9");

            console.Add(CLogLevel.Debug, tag, "b7");
            AssertVisibleRows(consoleView, "a5", "a6", "a7", "a8", "a9");

            console.Add(CLogLevel.Debug, tag, "b8");
            AssertVisibleRows(consoleView, "a5", "a6", "a7", "a8", "a9");

            console.Add(CLogLevel.Debug, tag, "a10");
            AssertVisibleRows(consoleView, "a6", "a7", "a8", "a9", "a10");

            console.Add(CLogLevel.Debug, tag, "b9");
            AssertVisibleRows(consoleView, "a6", "a7", "a8", "a9", "a10");

            console.Add(CLogLevel.Debug, tag, "b10");
            AssertVisibleRows(consoleView, "a7", "a8", "a9", "a10");

            console.Add(CLogLevel.Debug, tag, "b11");
            AssertVisibleRows(consoleView, "a7", "a8", "a9", "a10");

            console.Add(CLogLevel.Debug, tag, "b12");
            AssertVisibleRows(consoleView, "a7", "a8", "a9", "a10");

            console.Add(CLogLevel.Debug, tag, "b13");
            AssertVisibleRows(consoleView, "a8", "a9", "a10");

            console.Add(CLogLevel.Debug, tag, "b14");
            AssertVisibleRows(consoleView, "a9", "a10");

            console.Add(CLogLevel.Debug, tag, "b15");
            AssertVisibleRows(consoleView, "a10");

            console.Add(CLogLevel.Debug, tag, "b16");
            AssertVisibleRows(consoleView, "a10");

            console.Add(CLogLevel.Debug, tag, "b17");
            AssertVisibleRows(consoleView, "a10");

            console.Add(CLogLevel.Debug, tag, "b18");
            AssertVisibleRows(consoleView);

            console.Add(CLogLevel.Debug, tag, "a11");
            AssertVisibleRows(consoleView, "a11");

            console.Add(CLogLevel.Debug, tag, "b19");
            AssertVisibleRows(consoleView, "a11");

            console.Add(CLogLevel.Debug, tag, "a12");
            AssertVisibleRows(consoleView, "a11", "a12");

            consoleView.SetFilterText("");
            AssertVisibleRows(consoleView, "b12", "b13", "b14", "b15", "b16", "b17", "b18", "a11", "b19", "a12");
        }