Example #1
0
        public void WhenParsingAValidScheduleEntry()
        {
            var parsed = ScheduleEntry.Parse("12", 0, 24);

            Assert.IsNotNull(parsed);
            Assert.IsTrue(parsed.HasValue(12), "The value 12 should be in the parsed schedule");
            Assert.IsFalse(parsed.HasValue(18), "The value 18 should not be in the parsed schedule");
        }
Example #2
0
        public void WhenParsingAnInvalidRangeScheduleEntry()
        {
            ScheduleEntry parsed  = default;
            Exception     catched = default;

            try
            {
                parsed = ScheduleEntry.Parse("[12, 20]", 0, 14);
            }
            catch (Exception ex)
            {
                catched = ex;
            }

            Assert.IsNull(parsed);
            Assert.IsNotNull(catched);
            Assert.IsInstanceOfType(catched, typeof(ArgumentException));
        }