public void Support_testing_module_registration() { var builder = new MockContainerBuilder(); builder.RegisterModule <SampleModule>(); var builderShould = builder.Should(); builderShould.RegisterModule <SampleModule>(); builderShould.RegisterModule(typeof(SampleModule)); builderShould.RegisterModule <SampleModule2>(); }
/// <summary> /// Returns an <see cref="MockContainerBuilder"/> suitable for testing the specified module. /// </summary> /// <param name="module">The module</param> /// <param name="arrange">optional builder arrangement for the module</param> public static MockContainerBuilder Builder <TModule>(this TModule module, Action <ContainerBuilder> arrange = null) where TModule : Module, new() { if (module == null) { throw new ArgumentNullException(nameof(module)); } var builder = new MockContainerBuilder(); arrange?.Invoke(builder); builder.RegisterModule(module); return(builder); }