public void NegativeGetExceptionFilterForMethod() { var loggingSource1 = new LoggingSource1(null); try { loggingSource1.ThrowException(); } catch (Exception ex) { Filters.GetExceptionFilterForMethod <LoggingSource1>(nameof(LoggingSource1.LogException))(new LogEntry(DateTime.Now, "", LogLevel.Trace, "", "", new EventId(), ex)).Should().BeFalse(); } }
public void GetFilterForType(string name, string exceptionMessage, bool expectedResult) { if (string.IsNullOrEmpty(exceptionMessage)) { Filters.GetFilterForType <LoggingSource1>()(new LogEntry(DateTime.Now, name, LogLevel.Trace, "", "", new EventId(), null)).Should().Be(expectedResult); } else { var loggingSource1 = new LoggingSource1(null); try { loggingSource1.ThrowException(); } catch (Exception ex) { Filters.GetFilterForType <LoggingSource1>()(new LogEntry(DateTime.Now, name, LogLevel.Trace, "", "", new EventId(), ex)).Should().Be(expectedResult); } } }