public void OverridesHowKernelIsCreated() { Func <IKernel> creator = () => { return(new FakeKernel()); }; KernelManager.SetKernelResolver(creator); IKernel kernel = KernelManager.GetKernel(); Assert.AreEqual(@"fainting.goat.tests.FakeKernel", kernel.GetType().FullName); }
public MvcApplication() { if (MvcApplication.Kernel == null) { lock (KernelLock) { if (MvcApplication.Kernel == null) { MvcApplication.Kernel = this.RegisterNinject(); KernelManager.SetKernelResolver(() => { return(MvcApplication.Kernel); }); } } } }
public void SettingToNullGoesBackToDefault() { Func <IKernel> creator = () => { return(new FakeKernel()); }; KernelManager.SetKernelResolver(creator); IKernel kernel = KernelManager.GetKernel(); Assert.AreEqual(@"fainting.goat.tests.FakeKernel", kernel.GetType().FullName); // set to null to get default behavior KernelManager.SetKernelResolver(null); kernel = KernelManager.GetKernel(); Assert.IsNotNull(kernel); Assert.AreEqual(@"Ninject.StandardKernel", kernel.GetType().FullName); }