public void ResolveAll_Should_Use_Container() { _container.Setup(c => c.ResolveAll <IDummyObject>()).Returns((IDummyObject[])null).Verifiable(); _container.Setup(c => c.Resolve <IDummyObject>()).Returns((IDummyObject)null).Verifiable(); _resolver.ResolveAll <IDummyObject>(); }
public void ResolveAll_Should_Return_All_Registed_Types() { var resolver = new UnityDependencyResolver(); resolver.RegisterType<IFace1, Class1>(); resolver.RegisterType<IFace1, Class2>(); resolver.RegisterInstance<IFace1>(new Class3()); var resolveAll = resolver.ResolveAll<IFace1>(); Assert.Equal(3, resolveAll.Count()); Assert.True(resolveAll.OfType<Class1>().Any()); Assert.True(resolveAll.OfType<Class2>().Any()); Assert.True(resolveAll.OfType<Class3>().Any()); }
public void ResolveAll_Should_Return_All_Registed_Types() { var resolver = new UnityDependencyResolver(); 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()); }