public async Task CoreLogger_Should_LogError() { // Arrange bool wasLogExecuted = false; var helpers = GetHelpers(); helpers.LoggerStub .Setup(l => l.Log(LogLevel.Error, It.IsAny <EventId>(), It.IsAny <object>(), It.IsAny <Exception>(), It.IsAny <Func <object, Exception, string> >())) .Callback(() => wasLogExecuted = true); var coreLogger = new CoreLogger(helpers.LoggerStub.Object); // Act await coreLogger.LogErrorAsync(helpers.Correlation, "Testing loggers", new InvalidOperationException("Testing loggers"), helpers.Causation); // Assert wasLogExecuted.Should().BeTrue(); }