public void TruncateToHour() { var time = LocalTime.FromMinutesSinceMidnight(63); var truncated = Snippet.For(TimeAdjusters.TruncateToHour(time)); Assert.AreEqual(LocalTime.FromHoursSinceMidnight(1), truncated); }
public async Task Should_Destructure_NodaTime_LocalTime() { using var _ = CaptureLogs(out var logs); Logger.LogInformation("This is just a test {@Data}", LocalTime.FromHoursSinceMidnight(4)); await Verify(logs.Select(z => z.RenderMessage())); }
public void FromHoursSinceMidnight_RangeChecks() { Assert.Throws <ArgumentOutOfRangeException>(() => LocalTime.FromHoursSinceMidnight(-1)); Assert.Throws <ArgumentOutOfRangeException>(() => LocalTime.FromHoursSinceMidnight(NodaConstants.HoursPerDay)); }
public void FromHoursSinceMidnight_Valid() { Assert.AreEqual(LocalTime.Midnight, LocalTime.FromHoursSinceMidnight(0)); Assert.AreEqual(LocalTime.Midnight - Period.FromHours(1), LocalTime.FromHoursSinceMidnight(NodaConstants.HoursPerDay - 1)); }