Esempio n. 1
0
        public void TruncateToMinute()
        {
            var time      = LocalTime.FromSecondsSinceMidnight(127);
            var truncated = Snippet.For(TimeAdjusters.TruncateToMinute(time));

            Assert.AreEqual(LocalTime.FromMinutesSinceMidnight(2), truncated);
        }
Esempio n. 2
0
        public void TruncateToHour()
        {
            var time      = LocalTime.FromMinutesSinceMidnight(63);
            var truncated = Snippet.For(TimeAdjusters.TruncateToHour(time));

            Assert.AreEqual(LocalTime.FromHoursSinceMidnight(1), truncated);
        }
Esempio n. 3
0
 public void FromMinutesSinceMidnight_RangeChecks()
 {
     Assert.Throws <ArgumentOutOfRangeException>(() => LocalTime.FromMinutesSinceMidnight(-1));
     Assert.Throws <ArgumentOutOfRangeException>(() => LocalTime.FromMinutesSinceMidnight(NodaConstants.MinutesPerDay));
 }
Esempio n. 4
0
 public void FromMinutesSinceMidnight_Valid()
 {
     Assert.AreEqual(LocalTime.Midnight, LocalTime.FromMinutesSinceMidnight(0));
     Assert.AreEqual(LocalTime.Midnight - Period.FromMinutes(1), LocalTime.FromMinutesSinceMidnight(NodaConstants.MinutesPerDay - 1));
 }