public void CaseInsensitiveContext()
        {
            XmlApplicationContext ctx =
                new XmlApplicationContext(false, "assembly://Oragon.Spring.Core.Tests/Oragon.Spring.Context.Support/objects.xml");

            Assert.IsTrue(ctx.ContainsObject("goran"));
            Assert.IsTrue(ctx.ContainsObject("Goran"));
            Assert.IsTrue(ctx.ContainsObject("GORAN"));
            Assert.AreEqual(ctx.GetObject("goran"), ctx.GetObject("GORAN"));
        }
        public void ContextWithPostProcessors()
        {
            CountingObjectPostProcessor.Count       = 0;
            CoutingObjectFactoryPostProcessor.Count = 0;

            IApplicationContext ctx =
                new XmlApplicationContext("assembly://Oragon.Spring.Core.Tests/Oragon.Spring.Context.Support/objects.xml");

            Assert.IsTrue(ctx.ContainsObject("abstractObjectProcessorPrototype"));
            Assert.IsTrue(ctx.ContainsObject("abstractFactoryProcessorPrototype"));

            Assert.AreEqual(0, CountingObjectPostProcessor.Count);
            Assert.AreEqual(0, CoutingObjectFactoryPostProcessor.Count);
        }
        public void SingleConfigLocation()
        {
            XmlApplicationContext ctx =
                new XmlApplicationContext(false, "assembly://Oragon.Spring.Core.Tests/Oragon.Spring.Context.Support/simpleContext.xml");

            Assert.IsTrue(ctx.ContainsObject("someMessageSource"));
            ctx.Dispose();
        }
        public void GetObjectOnUnknownIdThrowsNoSuchObjectDefinition()
        {
            XmlApplicationContext ctx =
                new XmlApplicationContext(false, "assembly://Oragon.Spring.Core.Tests/Oragon.Spring.Context.Support/objects.xml");
            string DOES_NOT_EXIST = "does_not_exist";

            Assert.IsFalse(ctx.ContainsObject(DOES_NOT_EXIST));
            Assert.Throws <NoSuchObjectDefinitionException>(() => ctx.GetObject(DOES_NOT_EXIST));
        }
        public void ContextWithInvalidLazyType()
        {
            XmlApplicationContext ctx =
                new XmlApplicationContext(false,
                                          "assembly://Oragon.Spring.Core.Tests/Oragon.Spring.Context.Support/invalidType.xml");

            Assert.IsTrue(ctx.ContainsObject("someMessageSource"));
            ctx.GetObject("someMessageSource");
        }
        public void MultipleConfigLocations()
        {
            XmlApplicationContext ctx =
                new XmlApplicationContext(false, "assembly://Oragon.Spring.Core.Tests/Oragon.Spring.Context.Support/contextB.xml",
                                          "assembly://Oragon.Spring.Core.Tests/Oragon.Spring.Context.Support/contextC.xml",
                                          "assembly://Oragon.Spring.Core.Tests/Oragon.Spring.Context.Support/contextA.xml");

            Assert.IsTrue(ctx.ContainsObject("service"));
            Assert.IsTrue(ctx.ContainsObject("logicOne"));
            Assert.IsTrue(ctx.ContainsObject("logicTwo"));
            Service service = (Service)ctx.GetObject("service");

            ctx.Refresh();
            Assert.IsTrue(service.ProperlyDestroyed);
            service = (Service)ctx.GetObject("service");
            ctx.Dispose();
            Assert.IsTrue(service.ProperlyDestroyed);
        }