public void CanResolveCyclicSingletonFactoryObjectProductDependencies()
        {
            AbstractObjectFactory of = this.CreateObjectFactory(true);

            GenericObjectDefinition od = new GenericObjectDefinition();

            od.ObjectTypeName = typeof(TestObject).FullName;
            od.IsSingleton    = true;
            od.PropertyValues.Add(new PropertyValue("Spouse", new RuntimeObjectReference("product2")));
            of.RegisterObjectDefinition("product1Target", od);

            GenericObjectDefinition od2 = new GenericObjectDefinition();

            od2.ObjectTypeName = typeof(TestObject).FullName;
            od2.IsSingleton    = true;
            od2.PropertyValues.Add(new PropertyValue("Sibling", new RuntimeObjectReference("product1")));
            of.RegisterObjectDefinition("product2Target", od2);

            of.RegisterSingleton("product1", new ObjectReferenceFactoryObject("product1Target", of));
            of.RegisterSingleton("product2", new ObjectReferenceFactoryObject("product2Target", of));

            TestObject to = (TestObject)of.GetObject("product1");

            Assert.NotNull(to);
            Assert.NotNull(to.Spouse);
            Assert.NotNull(((TestObject)to.Spouse).Sibling);
        }
        public void RespectsCaseInsensitiveNamesAndAliases()
        {
            AbstractObjectFactory of = CreateObjectFactory(false);

            object testObject = new object();
            of.RegisterSingleton("name", testObject);
            of.RegisterAlias("NAME", "alias");

            try
            {
                of.RegisterAlias("NaMe", "AlIaS");
                Assert.Fail();
            }
            catch (ObjectDefinitionStoreException ex)
            {
                Assert.IsTrue(-1 < ex.Message.IndexOf("already registered"));
            }

            Assert.AreEqual(1, of.GetAliases("nAmE").Length);
            Assert.AreEqual(testObject, of.GetObject("nAmE"));
            Assert.AreEqual(testObject, of.GetObject("ALIAS"));
        }