コード例 #1
0
        public void LoggerManager_FilterEntries_ZeroEntries()
        {
            var manager = new MockLogManager();

            manager.UnfilteredQueue = new MockQueue();
            manager.FilteredQueue   = new MockQueue();

            manager.ExecuteFilter();
            Assert.IsTrue(manager.FilterCalled, "Filter was not called.");
        }
コード例 #2
0
        public void LoggerManager_FilterEntries_ThreeEntries()
        {
            var manager = new MockLogManager();

            manager.ExecutePublishFilter = false;
            var unfilteredQueue = new MemoryQueue();

            unfilteredQueue.Enqueue(new LogEntry
            {
                Title    = "test",
                EventId  = 1,
                Priority = 1,
                Severity = TraceEventType.Error,
                Message  = "testing"
            });
            unfilteredQueue.Enqueue(new LogEntry
            {
                Title    = "test",
                EventId  = 1,
                Priority = 1,
                Severity = TraceEventType.Error,
                Message  = "testing"
            });
            unfilteredQueue.Enqueue(new LogEntry
            {
                Title    = "test",
                EventId  = 1,
                Priority = 1,
                Severity = TraceEventType.Error,
                Message  = "testing"
            });

            manager.UnfilteredQueue = unfilteredQueue;
            var filteredQueue = new MemoryQueue();

            manager.FilteredQueue = filteredQueue;
            manager.Initialize(new Uri("http://test"));
            manager.ExecuteFilter();
            Assert.IsTrue(manager.FilterCalled, "Filter was not called.");
            Assert.AreEqual(3, manager.FilteredQueue.Count, "Filters were not executed correctly.");
        }