public async Task BindToAValueBindingContextWhenThereIsNoCurrentLogger() { // Act IValueProvider actual = await _sut.BindAsync(null, _valueBindingContext).ConfigureAwait(false); // Assert actual.Should().NotBeNull().And.BeAssignableTo <LoggerValueProvider>(); }
public async Task UseTheGlobalLoggerIfNoneSpecified() { // Arrange - Use a different constructor to test whether the global logger is used. var sut = new LoggerBinding(ParameterInfo); // Set-up the global logger to be a ILogEventSink. var mockSink = new Mock <ILogEventSink>(); Log.Logger = mockSink.As <ILogger>().Object; // Act var provider = (LoggerValueProvider)await sut.BindAsync(_bindingContext).ConfigureAwait(false); // Assert provider.Log.Error("A message"); mockSink.Verify(s => s.Emit(It.IsAny <LogEvent>()), Times.Once); }