Ejemplo n.º 1
0
        /// <summary>
        /// Parses input list of string and returns list of JobEntry
        /// </summary>
        /// <param name="jobList"></param>
        /// <returns>List of JobEntry</returns>
        public IList <JobEntry> Parse(IList <string> jobList)
        {
            var result = new List <JobEntry>();

            foreach (var entry in jobList)
            {
                if (!entry.Contains("=>"))
                {
                    throw new InvalidOperationException($"Invalid format: {entry}");
                }

                var splittedJobs = entry.Split(new string[] { "=>" }, StringSplitOptions.None);
                var jobEntry     = new JobEntry
                {
                    Name             = splittedJobs[0].Trim(),
                    DependsOnJobName = splittedJobs[1].Trim()
                };
                // Validate
                _validator.Validate(jobEntry);
                result.Add(jobEntry);
            }
            return(result);
        }