public void Can_resolve_all_instances_of_type_object() { var builder = new ContainerBuilder(); for (int i = 0; i < 10; i++) { builder.Register(c => new object()); } var container = builder.Build(); IServiceLocator locator = new LightCoreAdapter(container); var instances = locator.GetAllInstances(typeof(object)); Assert.IsNotNull(instances); Assert.IsInstanceOf<IEnumerable<object>>(instances); }
public void Can_resolve_all_instances_generic() { var builder = new ContainerBuilder(); for (int i = 0; i < 10; i++) { builder .Register(c => new List<string>()); } var container = builder.Build(); IServiceLocator locator = new LightCoreAdapter(container); var instances = locator.GetAllInstances<IList<string>>(); Assert.IsNotNull(instances); Assert.IsInstanceOf<IEnumerable<IList<string>>>(instances); }
public void Can_resolve_all_instances_generic() { var builder = new ContainerBuilder(); for (int i = 0; i < 10; i++) { builder .RegisterFactory(c => new List <string>()); } var container = builder.Build(); IServiceLocator locator = new LightCoreAdapter(container); var instances = locator.GetAllInstances <List <string> >().ToList(); instances.Should().NotBeNull(); instances.Should().BeAssignableTo <List <List <string> > >(); }
public void Can_resolve_all_instances_of_type_object() { var builder = new ContainerBuilder(); for (int i = 0; i < 10; i++) { builder.RegisterFactory(c => new object()); } var container = builder.Build(); IServiceLocator locator = new LightCoreAdapter(container); var instances = locator.GetAllInstances(typeof(object)); instances.Should().NotBeNull(); instances.Should().BeAssignableTo <IEnumerable <object> >(); }