Пример #1
0
            public void ReturnsTheKernel()
            {
                IKernel kernel = KernelManager.GetKernel();

                Assert.IsNotNull(kernel);

                Assert.AreEqual(@"Ninject.StandardKernel", kernel.GetType().FullName);
            }
Пример #2
0
            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);
            }
Пример #3
0
            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);
            }