public void Configure_UseDefaultResourceInspectorsFalse_DoesNotAddResourceInspectors() { var resourceFactory = ResourceFactory.Object; IConfigureOptions <HalOptions> setup = new HalSetup(ServiceProvider.Object, resourceFactory); var options = new HalOptions { UseDefaultResourceInspectors = false }; setup.Configure(options); Assert.AreEqual(0, options.ResourceInspectors.Count); }
public void Configure_UseDefaultResourceInspectors_AddsResourceValidationInspector() { var services = new ServiceCollection(); services.AddMvcCore(); services.AddLogging(); services.AddSingleton(Mock.Of <LinkService>()); var provider = services.BuildServiceProvider(); IConfigureOptions <HalOptions> setup = new HalSetup(provider, ResourceFactory.Object); var options = new HalOptions { UseDefaultResourceInspectors = true }; setup.Configure(options); Assert.That(options.ResourceInspectors, Has.One.InstanceOf <ResourceValidationInspector>()); }
public void Configure_OptionsNullThrows() { IConfigureOptions <HalOptions> options = new HalSetup(ServiceProvider.Object, ResourceFactory.Object); Assert.Throws <ArgumentNullException>(() => options.Configure(null)); }