protected override void OnStartup(StartupEventArgs e)
        {
            var kernel = NinjectDependencyResolver.ResolveAll();

            NinjectDependencyInjector.Instance.Initialize(kernel);
            base.OnStartup(e);
        }
Beispiel #2
0
        public void ResolveAll_Should_Return_All_Registed_Types()
        {
            var resolver = new NinjectDependencyResolver();

            resolver.RegisterType <IFace1, Class1>();
            resolver.RegisterType <IFace1, Class2>();
            resolver.RegisterInstance <IFace1>(new Class3());

            var resolveAll = resolver.ResolveAll <IFace1>();

            Assert.AreEqual(3, resolveAll.Count());
            Assert.IsTrue(resolveAll.OfType <Class1>().Any());
            Assert.IsTrue(resolveAll.OfType <Class2>().Any());
            Assert.IsTrue(resolveAll.OfType <Class3>().Any());
        }
        public void ResolveAll_Should_Return_All_Registed_Types()
        {
            var resolver = new NinjectDependencyResolver();
            resolver.RegisterType<IFace1, Class1>();
            resolver.RegisterType<IFace1, Class2>();
            resolver.RegisterInstance<IFace1>(new Class3());

            var resolveAll = resolver.ResolveAll<IFace1>();
            Assert.AreEqual(3, resolveAll.Count());
            Assert.IsTrue(resolveAll.OfType<Class1>().Any());
            Assert.IsTrue(resolveAll.OfType<Class2>().Any());
            Assert.IsTrue(resolveAll.OfType<Class3>().Any());
        }