public void ConfigureApiBehaviorOptions_InvokesSetupAction() { // Arrange var serviceCollection = new ServiceCollection() .AddOptions(); var builder = new MvcBuilder( serviceCollection, new ApplicationPartManager()); var part = new TestApplicationPart(); // Act var result = builder.ConfigureApiBehaviorOptions(o => { o.SuppressMapClientErrors = true; }); // Assert var options = serviceCollection. BuildServiceProvider() .GetRequiredService <IOptions <ApiBehaviorOptions> >() .Value; Assert.True(options.SuppressMapClientErrors); }
public void ConfigureApplicationParts_InvokesSetupAction() { // Arrange var builder = new MvcBuilder( Mock.Of <IServiceCollection>(), new ApplicationPartManager()); var part = new TestApplicationPart(); // Act var result = builder.ConfigureApplicationPartManager(manager => { manager.ApplicationParts.Add(part); }); // Assert Assert.Same(result, builder); Assert.Equal(new ApplicationPart[] { part }, builder.PartManager.ApplicationParts.ToArray()); }
public void ConfigureApplicationParts_InvokesSetupAction() { // Arrange var builder = new MvcBuilder( Mock.Of<IServiceCollection>(), new ApplicationPartManager()); var part = new TestApplicationPart(); // Act var result = builder.ConfigureApplicationPartManager(manager => { manager.ApplicationParts.Add(part); }); // Assert Assert.Same(result, builder); Assert.Equal(new ApplicationPart[] { part }, builder.PartManager.ApplicationParts.ToArray()); }