public void TruncateToMinute() { var time = LocalTime.FromSecondsSinceMidnight(127); var truncated = Snippet.For(TimeAdjusters.TruncateToMinute(time)); Assert.AreEqual(LocalTime.FromMinutesSinceMidnight(2), truncated); }
public void TruncateToHour() { var time = LocalTime.FromMinutesSinceMidnight(63); var truncated = Snippet.For(TimeAdjusters.TruncateToHour(time)); Assert.AreEqual(LocalTime.FromHoursSinceMidnight(1), truncated); }
public void FromMinutesSinceMidnight_RangeChecks() { Assert.Throws <ArgumentOutOfRangeException>(() => LocalTime.FromMinutesSinceMidnight(-1)); Assert.Throws <ArgumentOutOfRangeException>(() => LocalTime.FromMinutesSinceMidnight(NodaConstants.MinutesPerDay)); }
public void FromMinutesSinceMidnight_Valid() { Assert.AreEqual(LocalTime.Midnight, LocalTime.FromMinutesSinceMidnight(0)); Assert.AreEqual(LocalTime.Midnight - Period.FromMinutes(1), LocalTime.FromMinutesSinceMidnight(NodaConstants.MinutesPerDay - 1)); }