public void TryingToUnloadAModuleThatIsNotLoadedThrowsException() { var moduleA = new MockModuleA(); using (var kernel = new StandardKernel()) kernel.Unload(moduleA); }
public void BindingsAreRemovedWhenModulesAreUnloaded() { var moduleA = new MockModuleA(); var moduleB = new MockModuleB(); using (var kernel = new StandardKernel(moduleA, moduleB)) { var one = kernel.Get<IServiceA>(); Assert.That(one, Is.Not.Null); Assert.That(one, Is.InstanceOfType(typeof(ServiceImplA))); var two = kernel.Get<IServiceB>(); Assert.That(two, Is.Not.Null); Assert.That(two, Is.InstanceOfType(typeof(ServiceImplB))); kernel.Unload(moduleA); Assert.That(kernel.Components.BindingRegistry.HasBinding(typeof(IServiceA)), Is.False); } }