public void TestMultipleSchedulers()
        {
            XmlApplicationContext ctx = new XmlApplicationContext("multipleSchedulers.xml");

            try
            {
                IScheduler scheduler1 = (IScheduler)ctx.GetObject("scheduler1");
                IScheduler scheduler2 = (IScheduler)ctx.GetObject("scheduler2");
                Assert.AreNotSame(scheduler1, scheduler2);
                Assert.AreEqual("quartz1", scheduler1.SchedulerName);
                Assert.AreEqual("quartz2", scheduler2.SchedulerName);

                XmlApplicationContext ctx2 = new XmlApplicationContext("multipleSchedulers.xml");
                try
                {
                    IScheduler scheduler1a = (IScheduler)ctx2.GetObject("scheduler1");
                    IScheduler scheduler2a = (IScheduler)ctx2.GetObject("scheduler2");
                    Assert.AreNotSame(scheduler1a, scheduler2a);
                    Assert.AreNotSame(scheduler1a, scheduler1);
                    Assert.AreNotSame(scheduler2a, scheduler2);
                    Assert.AreEqual("quartz1", scheduler1a.SchedulerName);
                    Assert.AreEqual("quartz2", scheduler2a.SchedulerName);
                }
                finally
                {
                    ctx2.Dispose();
                }
            }
            finally
            {
                ctx.Dispose();
            }
        }
        public void TestSchedulerRepositoryExposure()
        {
            XmlApplicationContext ctx = new XmlApplicationContext("schedulerRepositoryExposure.xml");

            Assert.AreSame(SchedulerRepository.Instance.Lookup("myScheduler"), ctx.GetObject("scheduler"));
            ctx.Dispose();
        }
        public void Main()
        {
            var ctx = new XmlApplicationContext("objects.xml");
            var o1  = ctx.GetObject("SingletonObject");
            var o2  = ctx.GetObject("ProtoTypeObject");

            ctx.Dispose();
        }
        public async Task TestSchedulerRepositoryExposure()
        {
            XmlApplicationContext ctx = new XmlApplicationContext("schedulerRepositoryExposure.xml");
            var expected = await SchedulerRepository.Instance.Lookup("myScheduler");

            Assert.AreSame(expected, ctx.GetObject("scheduler"));
            ctx.Dispose();
        }
        public void TestSchedulerAccessorObject()
        {
            XmlApplicationContext ctx = new XmlApplicationContext("schedulerAccessorObject.xml");

            Thread.Sleep(3000);
            try
            {
                QuartzTestObject exportService = (QuartzTestObject)ctx.GetObject("exportService");
                QuartzTestObject importService = (QuartzTestObject)ctx.GetObject("importService");

                Assert.AreEqual(0, exportService.ImportCount, "doImport called exportService");
                Assert.AreEqual(2, exportService.ExportCount, "doExport not called on exportService");
                Assert.AreEqual(2, importService.ImportCount, "doImport not called on importService");
                Assert.AreEqual(0, importService.ExportCount, "doExport called on importService");
            }
            finally
            {
                ctx.Dispose();
            }
        }
        public void TestWithTwoAnonymousMethodInvokingJobDetailFactoryObjects()
        {
            XmlApplicationContext ctx = new XmlApplicationContext("multipleAnonymousMethodInvokingJobDetailFB.xml");

            Thread.Sleep(3000);
            try
            {
                QuartzTestObject exportService = (QuartzTestObject)ctx.GetObject("exportService");
                QuartzTestObject importService = (QuartzTestObject)ctx.GetObject("importService");

                Assert.AreEqual(0, exportService.ImportCount, "doImport called exportService");
                Assert.AreEqual(2, exportService.ExportCount, "doExport not called on exportService");
                Assert.AreEqual(2, importService.ImportCount, "doImport not called on importService");
                Assert.AreEqual(0, importService.ExportCount, "doExport called on importService");
            }
            finally
            {
                ctx.Dispose();
            }
        }
 public void TearDown()
 {
     appContext.Dispose();
     model.Clear();
 }