public void AddConventionalRegistrar_T() { var context = new ConfigureServicesContext(null, new ServiceCollection(), null); context.AddConventionalRegistrar <EmptyConventionalDependencyRegistrar>(); context.Services.GetSingletonInstanceOrNull <ConventionalRegistrarList>().Any(c => c.GetType() == typeof(EmptyConventionalDependencyRegistrar)).ShouldBeTrue(); }
public void RegisterAssemblyByConvention3() { var context = new ConfigureServicesContext(null, new ServiceCollection(), null); var registrar = new EmptyConventionalDependencyRegistrar(); context.AddConventionalRegistrar(registrar); context.Services.GetSingletonInstanceOrNull <ConventionalRegistrarList>().Contains(registrar).ShouldBeTrue(); var assembly = typeof(ConfigureServicesContextExtensions_Tests).Assembly.GetTypes(); context.RegisterAssemblyByConventionOfType <ConfigureServicesContextExtensions_Tests>(); registrar.RegisterAssemblyInvoked.ShouldBeTrue(); registrar.Types.ShouldBe(assembly); }