Пример #1
0
 public void EveryMinute()
 {
     var expected = new DateTime(2015, 1, 1, 5, 24, 0);
     var from = new DateTime(2015, 1, 1, 5, 23, 0);
     var sut = new Minute();
     Assert.AreEqual(expected, sut.Evaluate(from));
 }
Пример #2
0
 internal override OperatorBuilder InternalBuild()
 {
     var minute = new Minute { OffsetInSeconds = _offset };
     return new OperatorBuilder(constraints =>
     {
         minute.AddConstraints(constraints);
         return minute;
     });
 }
        public override void ExitEveryminute(GoldenFoxLanguageParser.EveryminuteContext context)
        {
            if (!Current.SecondsOffset.Any())
            {
                Current.SecondsOffset.Push(0);
            }

            var constraints = new List<IConstraint>();
            while (Current.Constraints.Any())
            {
                constraints.Add(Current.Constraints.Pop());
            }

            while (Current.SecondsOffset.Any())
            {
                var min = new Minute { OffsetInSeconds = Current.SecondsOffset.Pop() };
                if (constraints.Any())
                {
                    min.AddConstraints(constraints);
                }

                _stack.Push(min);
            }
        }