示例#1
0
        public void ResolveAll_Should_Return_All_Registed_Types()
        {
            var resolver = new SimpleInjectorDependencyResolver();

            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 SimpleInjectorDependencyResolver();
            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());
        }