public void BeforeEach() { errorLogger = new Mock <ILogger>(); usageLogger = new Mock <ILogger>(); diagnosticsLogger = new Mock <ILogger>(); perfLogger = new Mock <ILogger>(); options = new Mock <IOptions <PocedLoggingSettings> >(); options.Setup(o => o.Value).Returns(new PocedLoggingSettings()); PocedSerilogLogger = new PocedSerilogLogger(perfLogger.Object, usageLogger.Object, errorLogger.Object, diagnosticsLogger.Object, options.Object); }
public void WhenWriteDiagnosticIsCalled_And_DiagnosticsIsEnabled_ThenTheDiagnosticLoggerShouldBeUsed() { options = new Mock <IOptions <PocedLoggingSettings> >(); options.Setup(o => o.Value).Returns(new PocedLoggingSettings { WriteDiagnostics = true }); PocedSerilogLogger = new PocedSerilogLogger(perfLogger.Object, usageLogger.Object, errorLogger.Object, diagnosticsLogger.Object, options.Object); diagnosticsLogger.Setup(l => l.Write(It.IsAny <LogEventLevel>(), It.IsAny <string>(), It.IsAny <LogDetail>())); PocedSerilogLogger.WriteDiagnostic(new LogDetail()); diagnosticsLogger.Verify(l => l.Write(It.IsAny <LogEventLevel>(), It.IsAny <string>(), It.IsAny <LogDetail>()), Times.Once); }