Example #1
0
        public void Parse_WhenValidInputString_ReturnsValidParsedOutput()
        {
            string[] args = { "*/15 0 1,15 * 1-5 /usr/bin/find" };

            var result = _sut.ParseExpression(args[0]);

            Assert.Contains("minute        0 15 30 45", result);
            Assert.Contains("hour          0", result);
            Assert.Contains("day of month  1 15", result);
            Assert.Contains("month         1 2 3 4 5 6 7 8 9 10 11 12", result);
            Assert.Contains("day of week   1 2 3 4 5", result);
            Assert.Contains("command       /usr/bin/find", result);
        }
        static void Main(string[] args)
        {
            if (args.Length != 1)
            {
                Console.Write("Invalid CRON expression passed in.");
                return;
            }

            try
            {
                var cronApplicationController = new CronApplicationController();
                var parsedExpression          = cronApplicationController.ParseExpression(args[0]);
                Console.WriteLine(parsedExpression);
            }

            catch (Exception ex)
            {
                Console.WriteLine(ex);
            }
        }