public void NestedScopesWithRecords_KeepOnlyWithMinimalLogLevelStaringOnFirstMessageOccurrence() { var queue = new GrowingQueue("") { RecordFactory.Create(0, "no ", RecordType.Record, LogLevel.Information), RecordFactory.Create(1, "no ", RecordType.ScopeBeginIgnored), RecordFactory.Create(1, "no ", RecordType.Record, LogLevel.Information), RecordFactory.Create(2, "no ", RecordType.ScopeBeginIgnored), RecordFactory.Create(2, "yes", RecordType.Record, LogLevel.Error), RecordFactory.Create(2, "no ", RecordType.Record, LogLevel.Information), RecordFactory.Create(3, "no ", RecordType.ScopeBeginIgnored), RecordFactory.Create(3, "no ", RecordType.Record, LogLevel.Information), RecordFactory.Create(3, "yes", RecordType.Record, LogLevel.Error), RecordFactory.Create(3, "no ", RecordType.ScopeEndIgnored), RecordFactory.Create(2, "yes", RecordType.Record, LogLevel.Error), RecordFactory.Create(2, "no ", RecordType.ScopeEndIgnored), RecordFactory.Create(1, "no ", RecordType.Record, LogLevel.Information), RecordFactory.Create(1, "no ", RecordType.ScopeEndIgnored), RecordFactory.Create(0, "no ", RecordType.Record, LogLevel.Information) }; var filter = new FlatQueueFilter(LogLevel.Error); var result = filter.Filter(queue); Assert.AreEqual(3, result.Count); Assert.IsTrue(result.All(l => l.Message == "yes")); }
public void IgnoreWrappingNotSpecifiedCategory() { var records = new List <Record>(); records.Add(RecordFactory.Create(Ignore, 0, "no ", RecordType.Record, LogLevel.Critical)); records.Add(RecordFactory.Create(Ignore, 1, "no ", RecordType.ScopeBeginIgnored)); records.Add(RecordFactory.Create(Ignore, 1, "no ", RecordType.Record, LogLevel.Critical)); records.Add(RecordFactory.Create(Categ1, 2, "yes", RecordType.ScopeBeginIgnored)); records.Add(RecordFactory.Create(Categ1, 2, "yes", RecordType.Record, LogLevel.Critical)); records.Add(RecordFactory.Create(Categ2, 2, "yes", RecordType.Record, LogLevel.Critical)); records.Add(RecordFactory.Create(Categ2, 3, "yes", RecordType.ScopeBeginIgnored)); records.Add(RecordFactory.Create(Categ2, 3, "yes", RecordType.Record, LogLevel.Critical)); records.Add(RecordFactory.Create(Categ2, 3, "yes", RecordType.ScopeEndIgnored)); records.Add(RecordFactory.Create(Categ2, 2, "yes", RecordType.Record, LogLevel.Critical)); records.Add(RecordFactory.Create(Categ1, 2, "yes", RecordType.Record, LogLevel.Critical)); records.Add(RecordFactory.Create(Categ1, 2, "yes", RecordType.ScopeEndIgnored)); records.Add(RecordFactory.Create(Ignore, 1, "no ", RecordType.Record, LogLevel.Critical)); records.Add(RecordFactory.Create(Ignore, 1, "no ", RecordType.ScopeEndIgnored)); records.Add(RecordFactory.Create(Ignore, 0, "no ", RecordType.Record, LogLevel.Critical)); RunAndAssert(records, 9, "yes"); }
public void WriteSingle_HigherLevel_OneMessageIsInserted() { var queue = new GrowingQueue("") { RecordFactory.Create(3, RecordType.Record, LogLevel.Error) }; var filter = new SendQueueFilter(LogLevel.Error); var result = filter.Filter(queue); Assert.AreEqual(1, result.Count); }
public void IgnoreCliQueue() { var queue = new GrowingQueue(Constants.CliTraceIdentifierPrefix) { RecordFactory.Create(0, RecordType.Record, LogLevel.Critical) }; var filter = new RequestQueueFilter(LogLevel.Trace); var result = filter.Filter(queue); Assert.AreEqual(0, result.Count); }
public void AcceptOnlyRequestRecords() { var queue = new GrowingQueue("request") { RecordFactory.Create(0, RecordType.Record, LogLevel.Trace) }; var filter = new RequestQueueFilter(LogLevel.Trace); var result = filter.Filter(queue); Assert.AreEqual(1, result.Count); }
public void AcceptOnlyRequestRecordsWithMinimalLogSeverity(LogLevel messageSeverity, LogLevel minimalSeverity, bool isLogged) { var queue = new GrowingQueue("request") { RecordFactory.Create(0, RecordType.Record, messageSeverity) }; var filter = new RequestQueueFilter(minimalSeverity); var result = filter.Filter(queue); Assert.AreEqual(isLogged ? 1 : 0, result.Count); }
public void IgnoreRequestQueue() { var queue = new GrowingQueue("request") { RecordFactory.Create(0, RecordType.Record, LogLevel.Critical) }; var filter = new ProcessQueueFilter(); var result = filter.Filter(queue); Assert.AreEqual(0, result.Count); }
public void AcceptsOnlyCliRecords() { var queue = new GrowingQueue(Constants.CliTraceIdentifierPrefix) { RecordFactory.Create(0, RecordType.Record, LogLevel.Trace) }; var filter = new ProcessQueueFilter(); var result = filter.Filter(queue); Assert.AreEqual(1, result.Count); }
public void WriteScopeAndLog_LogHasLowPriority_IgnoreScope() { var queue = new GrowingQueue("") { RecordFactory.Create(1, RecordType.ScopeBeginIgnored), RecordFactory.Create(1, RecordType.Record, LogLevel.Information) }; var filter = new SendQueueFilter(LogLevel.Error); var result = filter.Filter(queue); Assert.AreEqual(0, result.Count); }
public void RecordsOnly_FilterWithLowerPriorities(LogLevel minimalLevel, int expected) { var queue = new GrowingQueue("") { RecordFactory.Create(0, RecordType.Record, LogLevel.Critical), RecordFactory.Create(0, RecordType.Record, LogLevel.Error), RecordFactory.Create(0, RecordType.Record, LogLevel.Warning), RecordFactory.Create(0, RecordType.Record, LogLevel.Information), RecordFactory.Create(0, RecordType.Record, LogLevel.Debug), RecordFactory.Create(0, RecordType.Record, LogLevel.Trace) }; var filter = new FlatQueueFilter(minimalLevel); var result = filter.Filter(queue); Assert.AreEqual(expected, result.Count); }
public void WriteErrorInNestedScope_ShouldWrite() { var queue = new GrowingQueue("") { RecordFactory.Create(1, RecordType.ScopeBeginIgnored), RecordFactory.Create(1, RecordType.Record, LogLevel.Information), RecordFactory.Create(2, RecordType.ScopeBeginIgnored), RecordFactory.Create(2, RecordType.Record, LogLevel.Error), RecordFactory.Create(2, RecordType.ScopeEndIgnored), RecordFactory.Create(1, RecordType.Record, LogLevel.Information), RecordFactory.Create(1, RecordType.ScopeEndIgnored) }; var filter = new SendQueueFilter(LogLevel.Error); var result = filter.Filter(queue); Assert.AreEqual(7, result.Count); }