public static void Web(this IGenericHostConfigurator configurator, string name, Action <IWebComponentSetupConfigurator> config) { if (string.IsNullOrWhiteSpace(name)) { throw new ArgumentNullException(nameof(name)); } var spec = new WebComponentSetupSpecification(name); config?.Invoke(spec); configurator.AddComponentSpecification(spec); }
public void Given_BuilderAction_When_Apply_Then_IsExecuted() { var builder = A.Fake <IHostBuilder>(); var builderAction = A.Dummy <Action <IWebHostBuilder> >(); var sut = new WebComponentSetupSpecification("Name"); sut.ConfigureBuilder(builderAction); var component = sut.Apply(builder); Assert.That(component, Is.Not.Null); Assert.That(component, Is.TypeOf <WebComponent>()); A.CallTo(() => builderAction.Invoke(A <IWebHostBuilder> ._)).MustHaveHappened(); }