예제 #1
0
        public void Test_AddHours_Ok()
        {
            LocalTime localTime       = new LocalTime(2, 4);
            int       hoursToAdd      = 8;
            LocalTime localTimeResult = new LocalTime(10, 4);

            Assert.Equal(localTimeResult, localTime.AddHours(hoursToAdd));

            localTime       = new LocalTime(2, 4);
            hoursToAdd      = 25;
            localTimeResult = new LocalTime(3, 4);

            Assert.Equal(localTimeResult, localTime.AddHours(hoursToAdd));

            localTime       = new LocalTime(16, 4);
            hoursToAdd      = -4;
            localTimeResult = new LocalTime(12, 4);

            Assert.Equal(localTimeResult, localTime.AddHours(hoursToAdd));

            localTime       = new LocalTime(16, 4);
            hoursToAdd      = -20;
            localTimeResult = new LocalTime(20, 4);

            Assert.Equal(localTimeResult, localTime.AddHours(hoursToAdd));

            localTime       = new LocalTime(16, 4);
            hoursToAdd      = -26;
            localTimeResult = new LocalTime(14, 4);

            Assert.Equal(localTimeResult, localTime.AddHours(hoursToAdd));

            localTime       = new LocalTime(16, 4);
            hoursToAdd      = 0;
            localTimeResult = new LocalTime(16, 4);

            Assert.Equal(localTimeResult, localTime.AddHours(hoursToAdd));
        }