Exemplo n.º 1
0
        public void should_get_all_instances_of_an_interface()
        {
            var objectBoss = new ObjectBoss();
            objectBoss.Configure(x =>
                {
                    x.AddUsing<ISimpleInterface, SimpleObjectType>();
                    x.AddUsing<ISimpleInterface, AnotherSimpleObject>();
                });

            var allInstances = objectBoss.GetAllInstances<ISimpleInterface>().ToList();
            Assert.IsTrue(allInstances.Count == 2);
            var simpleObject1 = allInstances[0];
            Assert.IsNotNull(simpleObject1);
            Assert.IsTrue(simpleObject1.Name == "SimpleObject1");
            var simpleObject2 = allInstances[1];
            Assert.IsNotNull(simpleObject2);
            Assert.IsTrue(simpleObject2.Name == "SimpleObject2");
        }