public void DebugTest() { //-- Arrange var expectedLevel = "Debug"; var expected = "This is debug message. MessagePayload { SomeString = \"some payload\" }"; var actor = new SerilogAdapter(new Serilog.LoggerConfiguration() .WriteTo.MockConsole() .MinimumLevel.Debug()); //-- Act actor.Debug <object>(expected, new MessagePayload() { SomeString = "some payload" }); //-- Assert Assert.AreEqual($"{expectedLevel}:{expected}", MockSink.LastLogEntry); }
public void DebugLoggedUserTest() { //-- Arrange var userEnricher = new SerilogUserLogEnricher(); var expectedLevel = "Debug"; var expected = "This is debug message. MessagePayload { SomeString = \"some payload\" }"; var actor = new SerilogAdapter(new Serilog.LoggerConfiguration() .Enrich.FromLogContext() .WriteTo.MockConsoleForUser() .MinimumLevel.Debug()); //-- Act userEnricher.UserLoggedIn(User); actor.Debug <object>(expected, new MessagePayload() { SomeString = "some payload" }); //-- Assert Assert.AreEqual($"{expectedLevel}:[{User.UserName}] {expected}", MockFormatSink.LastLogEntry); }