public void ResolveAllUnregisteredTypeReturnsEmptyCollection() { var ioc = new MicroIocContainer(); var instances = ioc.ResolveAll(typeof(Foo)); Assert.IsNotNull(instances); Assert.AreEqual(0, instances.Count()); }
public void ResolveAllReturnsSingleRegisteredTypeInACollection() { var ioc = new MicroIocContainer() .Register <IFoo, Foo>(); var instances = ioc.ResolveAll(typeof(IFoo)); Assert.IsNotNull(instances); Assert.AreEqual(1, instances.Count()); Assert.IsInstanceOfType(instances.Single(), typeof(IFoo), "Registered instance should be an IFoo"); }
public void ResolveAllReturnsAllRegisteredTypesInACollection() { var ioc = new MicroIocContainer() .Register <IFoo, Foo>("One") .RegisterInstance <IFoo>(new Foo(), "Two") .Register <IFoo, Foo>("Three", true); var instances = ioc.ResolveAll(typeof(IFoo)); Assert.IsNotNull(instances); Assert.AreEqual(3, instances.Count()); }
public void ResolveAllUnregisteredTypeReturnsEmptyCollection() { var ioc = new MicroIocContainer(); var instances = ioc.ResolveAll(typeof (Foo)); Assert.IsNotNull(instances); Assert.AreEqual(0, instances.Count()); }
public void ResolveAllReturnsSingleRegisteredTypeInACollection() { var ioc = new MicroIocContainer() .Register<IFoo, Foo>(); var instances = ioc.ResolveAll(typeof(IFoo)); Assert.IsNotNull(instances); Assert.AreEqual(1, instances.Count()); Assert.IsInstanceOfType(instances.Single(), typeof(IFoo), "Registered instance should be an IFoo"); }
public void ResolveAllReturnsAllRegisteredTypesInACollection() { var ioc = new MicroIocContainer() .Register<IFoo, Foo>("One") .RegisterInstance<IFoo>(new Foo(), "Two") .Register<IFoo, Foo>("Three", true); var instances = ioc.ResolveAll(typeof(IFoo)); Assert.IsNotNull(instances); Assert.AreEqual(3, instances.Count()); }