public async Task LoggedActionLogException() { var logger = new Mock <ILogger>(); var factory = new LogEntryFactory("", "", ""); await Assert.ThrowsAsync <TestException>(async() => await factory.LoggedActionAsync(new ILogger[] { logger.Object }, new StaticTracingScope(), new Func <LogEntry, Task>(log => { throw new TestException("Foobar"); }))); logger.Verify(x => x.Publish(It.Is <LogEntry>(log => 400 >= log.Level && log.Messages.Count == 1 && string.Equals(log.Messages[0].Message, "Uncaught exception (<TestException> Foobar)") && !string.IsNullOrEmpty(log.Messages[0].Stacktrace) ))); }