private string RandomTime()
        {
            var time = LocalTime.FromHourMinuteSecondTick(_random.Next(1, 23), _random.Next(1, 59), 0, 0)
                       .ToString("H:mm", default);

            return(time);
        }
Example #2
0
        public void FromHourMinuteSecondTick_Valid()
        {
            var result = LocalTime.FromHourMinuteSecondTick(1, 2, 3, (int)(NodaConstants.TicksPerSecond - 1));

            Assert.AreEqual(1, result.Hour);
            Assert.AreEqual(2, result.Minute);
            Assert.AreEqual(3, result.Second);
            Assert.AreEqual((int)(NodaConstants.TicksPerSecond - 1), result.TickOfSecond);
        }
Example #3
0
 public void LocalTimeArrayTest()
 {
     LocalTime[] lt =
     { LocalTime.FromTicksSinceMidnight(4000),
       LocalTime.FromSecondsSinceMidnight(10000),
       LocalTime.FromHourMinuteSecondTick(20, 10, 1, 13),
       new LocalTime(),
       LocalTime.FromSecondsSinceMidnight(1) };
     Assert.Equal(TestTools.Convert(lt), lt);
 }
 public void FromHourMinuteSecondTick_Invalid(int hour, int minute, int second, int tick)
 {
     Assert.Throws <ArgumentOutOfRangeException>(
         () => LocalTime.FromHourMinuteSecondTick(hour, minute, second, tick));
 }