public void AssembliesNull_Should_Throws() { var services = new ServiceCollection(); var myLifetimeRegistry = new MyLifetimeRegistry(); myLifetimeRegistry.AutoRegister(services, null); }
public void TestInitialize() { services = new ServiceCollection(); myLifetimeRegistry = new MyLifetimeRegistry(); myLifetimeRegistry.AutoRegister(services, new[] { typeof(MyLifetimeRegistrySpec).Assembly }); provider = services.BuildServiceProvider(); }
public void RegisterAfter_Should_Replace() { var services = new ServiceCollection(); var myLifetimesHelper = new MyLifetimeRegistry(); myLifetimesHelper.AutoRegister(services, new[] { typeof(IMyLifetime).Assembly, typeof(MyLifetimeRegistrySpec).Assembly }); services.AddSingleton <FooTransient>(); var newProvider = services.BuildServiceProvider(); using (var scope = newProvider.CreateScope()) { var theFoo = scope.ServiceProvider.GetService <FooTransient>(); var theFoo2 = scope.ServiceProvider.GetService <FooTransient>(); Assert.AreSame(theFoo, theFoo2); } }
public void AssembliesNull_Should_Throws() { myLifetimeRegistry.AutoRegister(services, null); }
public void ServicesNull_Should_Throws() { var myLifetimeRegistry = new MyLifetimeRegistry(); myLifetimeRegistry.AutoRegister(null, new List <Assembly>()); }