public void JustHourNotInclusive() { var expected = new DateTime(2016, 2, 10, 9, 0, 0); var from = new DateTime(2016, 2, 10, 8, 15, 30); var sut = new Hour { }; Assert.AreEqual(expected, sut.Evaluate(from, false)); }
public void JustHourInclusiveExactSameTime() { var expected = new DateTime(2016, 2, 10, 9, 0, 0); var from = new DateTime(2016, 2, 10, 9, 0, 0); var sut = new Hour { }; Assert.AreEqual(expected, sut.Evaluate(from, true)); }
public void HourWithOffsetInMinutesAndSecondsFromBefore() { var expected = new DateTime(2016, 2, 10, 8, 15, 30); var from = new DateTime(2016, 2, 10, 8, 15, 29); var sut = new Hour { OffsetInSeconds = (15 * 60) + 30 }; Assert.AreEqual(expected, sut.Evaluate(from)); }
public void HourWithOffsetInMinutesAndSecondsExactlySameTimeNotInclusive() { var expected = new DateTime(2016, 2, 10, 9, 15, 30); var from = new DateTime(2016, 2, 10, 8, 15, 30); var sut = new Hour { OffsetInSeconds = (15 * 60) + 30 }; Assert.AreEqual(expected, sut.Evaluate(from, false)); }
internal override OperatorBuilder InternalBuild() { var hour = new Hour { OffsetInSeconds = _offset }; return new OperatorBuilder(constraints => { hour.AddConstraints(constraints); return hour; }); }
public override void ExitEveryhour(GoldenFoxLanguageParser.EveryhourContext 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 hour = new Hour { OffsetInSeconds = Current.SecondsOffset.Pop() }; if (constraints.Any()) { hour.AddConstraints(constraints); } _stack.Push(hour); } }