public void AddContextInitializer() { var services = new ServiceCollection(); var moduleType = typeof(StubModule1); var initializer = Substitute.For<IModuleContextInitializer<StubContext1>>(); var moduleBuilder = new ModuleBuilder(services, moduleType); moduleBuilder.AddContextInitializer(initializer); Assert.Equal(1, services.Count); Assert.Equal(typeof(ModuleContextInitializerDescriptor), services[0].ServiceType); Assert.Null(services[0].ImplementationType); Assert.NotNull(services[0].ImplementationInstance); Assert.Equal(typeof(ModuleContextInitializerDescriptor), services[0].ImplementationInstance.GetType()); Assert.Equal(ServiceLifetime.Singleton, services[0].Lifetime); }