/// <summary>
        /// Add a chain mapping - when the Job identified by the first key completes
        /// the job identified by the second key will be triggered.
        /// </summary>
        /// <param name="firstJob">a JobKey with the name and group of the first job</param>
        /// <param name="firstJobResult">what result of the first job triggers the second job</param>
        /// <param name="secondJob">a JobKey with the name and group of the follow-up job</param>
        public void AddJobChainLink(JobKey firstJob, JobResultCriteria firstJobResult, JobKey secondJob)
        {
            if (firstJob == null || secondJob == null)
            {
                throw new ArgumentException("Key cannot be null!");
            }
            if (String.IsNullOrEmpty(firstJob.Name) || String.IsNullOrEmpty(secondJob.Name))
            {
                throw new ArgumentException("Key cannot have a null name!");
            }

            _chainLinks.Add(new Tuple <JobKey, DependentJobDetails>(firstJob, new DependentJobDetails(firstJobResult, secondJob)));
        }
        public void AddJobChainLink_ForValidParameters_WillAddLink()
        {
            JobKey            jobA           = new JobKey("JobA");
            JobKey            jobB           = new JobKey("JobB");
            JobResultCriteria resultCriteria = JobResultCriteria.OnCompletion;

            _listener.AddJobChainLink(jobA, resultCriteria, jobB);

            var links = _listener.GetChainLinks();

            Assert.AreEqual(jobB, links.First(l => Equals(l.Item1, jobA)).Item2.DependentJobKey);
            Assert.AreEqual(resultCriteria, links.First(l => Equals(l.Item1, jobA)).Item2.PredecessorJobResult);
        }
 public DependentJobDetails(JobResultCriteria predecessorJobResult, JobKey dependentJobKey)
 {
     PredecessorJobResult = predecessorJobResult;
     DependentJobKey      = dependentJobKey;
 }