Пример #1
0
        public void TruncateToHour()
        {
            var time      = LocalTime.FromMinutesSinceMidnight(63);
            var truncated = Snippet.For(TimeAdjusters.TruncateToHour(time));

            Assert.AreEqual(LocalTime.FromHoursSinceMidnight(1), truncated);
        }
Пример #2
0
 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()));
 }
Пример #3
0
 public void FromHoursSinceMidnight_RangeChecks()
 {
     Assert.Throws <ArgumentOutOfRangeException>(() => LocalTime.FromHoursSinceMidnight(-1));
     Assert.Throws <ArgumentOutOfRangeException>(() => LocalTime.FromHoursSinceMidnight(NodaConstants.HoursPerDay));
 }
Пример #4
0
 public void FromHoursSinceMidnight_Valid()
 {
     Assert.AreEqual(LocalTime.Midnight, LocalTime.FromHoursSinceMidnight(0));
     Assert.AreEqual(LocalTime.Midnight - Period.FromHours(1), LocalTime.FromHoursSinceMidnight(NodaConstants.HoursPerDay - 1));
 }