public void LevelMatchFilter_EntriesWhichEvaluatesConditionToTrueReturnsMatch() { string condition = "message=='Hello World!'"; ConditionFilter filter = new ConditionFilter { Condition = condition, Action = LogFilterResult.Filter }; filter.Initialize(new InitializationContext(null, null)); Logger logger = new Logger(null, typeof(ConditionFilterTests)); ILogEntry trueEntry = new LogEntry(DateTimeOffset.Now, LogLevel.Information, "Hello World!", logger, null); ILogEntry falseEntry = new LogEntry(DateTimeOffset.Now, LogLevel.Information, "Goodbye World!", logger, null); Assert.AreEqual(LogFilterResult.Filter, filter.Evaluate(trueEntry)); Assert.AreEqual(LogFilterResult.Neutral, filter.Evaluate(falseEntry)); }
public void LevelMatchFilter_ThrowsIfLevelIsNotSetAtInitialization() { ConditionFilter filter = new ConditionFilter(); filter.Initialize(new InitializationContext(null, null)); }