Test job object that has injectable properties
Inheritance: Quartz.Job.NoOpJob
Ejemplo n.º 1
0
        public void TestCreateJobInstance_IgnoredProperties()
        {
            factory.IgnoredUnknownProperties = new string[] { "foo", "baz" };
            IOperableTrigger trigger = new SimpleTriggerImpl();

            trigger.JobDataMap["foo"]    = "should not be injected";
            trigger.JobDataMap["number"] = 123;
            TriggerFiredBundle bundle = TestUtil.CreateMinimalFiredBundleWithTypedJobDetail(typeof(InjectableJob), trigger);

            InjectableJob job = (InjectableJob)factory.NewJob(bundle, null);

            Assert.IsNotNull(job, "Created job was null");
            Assert.AreEqual(123, job.Number, "integer injection failed");
            Assert.IsNull(job.Foo, "foo was injected when it was not supposed to    ");
        }
Ejemplo n.º 2
0
        public void TestCreateJobInstance_SchedulerContextGiven()
        {
            IOperableTrigger   trigger = new SimpleTriggerImpl();
            TriggerFiredBundle bundle  = TestUtil.CreateMinimalFiredBundleWithTypedJobDetail(typeof(InjectableJob), trigger);

            IDictionary <string, object> items = new Dictionary <string, object>();

            items["foo"]             = "bar";
            items["number"]          = 123;
            factory.SchedulerContext = new SchedulerContext(items);
            InjectableJob job = (InjectableJob)factory.NewJob(bundle, null);

            Assert.IsNotNull(job, "Created job was null");
            Assert.AreEqual("bar", job.Foo, "string injection failed");
            Assert.AreEqual(123, job.Number, "integer injection failed");
        }