Esempio n. 1
0
        public void CreateJob()
        {
            var job = _job1;

            try
            {
                // store job
                _jobStore.StoreJob(job, false);
            }
            catch (ObjectAlreadyExistsException)
            {
                // if job already exists, we can change some property to test update process
                job.JobDataMap.Add("key2", "value2");

                // store job (actually update process)
                _jobStore.StoreJob(job, true);
            }

            // job should be exists
            Assert.IsTrue(_jobStore.CheckExists(job.Key));

            // and instances should be equal
            Assert.AreEqual(job, _jobStore.RetrieveJob(job.Key));

            var keys = _jobStore.GetJobKeys(GroupMatcher <JobKey> .GroupEquals(job.Key.Group));

            Assert.IsTrue(keys.Any(x => x.Equals(job.Key)));

            var groups = _jobStore.GetJobGroupNames();

            Assert.IsTrue(groups.Contains(job.Key.Group));
        }