public void GetSettingMustReturnValueWhenKeyExists() { MockWebHostBuilder builder = new MockWebHostBuilder(); builder.UseSetting("secret", "42"); Assert.Equal("42", builder.GetSetting("secret")); }
public void ConfigureServicesMustSetMockLoggerWhenCalled() { MockWebHostBuilder builder = new MockWebHostBuilder(); builder.ConfigureServices((_, __) => { }); Assert.NotNull(builder.MockLogger); }
public void ConfigureServicesMustConfigureMockLoggerFactoryWhenCalled() { MockWebHostBuilder builder = new MockWebHostBuilder(); IWebHost host = builder.ConfigureServices((_, __) => { }).Build(); Assert.IsAssignableFrom <MockLoggerFactory>(host.Services.GetRequiredService <ILoggerFactory>()); }
public void ConfigureServicesMustRegisterConfigureServicesDelegateWithWebHostBuilderContextWhenCalled() { MockWebHostBuilder builder = new MockWebHostBuilder(); int configureServicesCalled = 0; builder.ConfigureServices((_, __) => { ++configureServicesCalled; }).Build(); Assert.Equal(1, configureServicesCalled); }