コード例 #1
0
        public void Test_AddMilliseconds_Ok()
        {
            LocalTime localTime         = new LocalTime(2, 4, 8, 16);
            int       millisecondsToAdd = 16;
            LocalTime localTimeResult   = new LocalTime(2, 4, 8, 32);

            Assert.Equal(localTimeResult, localTime.AddMilliseconds(millisecondsToAdd));

            localTime         = new LocalTime(2, 4, 8, 16);
            millisecondsToAdd = 984;
            localTimeResult   = new LocalTime(2, 4, 9, 0);

            Assert.Equal(localTimeResult, localTime.AddMilliseconds(millisecondsToAdd));

            localTime         = new LocalTime(2, 4, 8, 16);
            millisecondsToAdd = 1016;
            localTimeResult   = new LocalTime(2, 4, 9, 32);

            Assert.Equal(localTimeResult, localTime.AddMilliseconds(millisecondsToAdd));

            localTime         = new LocalTime(2, 4, 8, 16);
            millisecondsToAdd = 2016;
            localTimeResult   = new LocalTime(2, 4, 10, 32);

            Assert.Equal(localTimeResult, localTime.AddMilliseconds(millisecondsToAdd));

            localTime         = new LocalTime(2, 4, 8, 16);
            millisecondsToAdd = -8;
            localTimeResult   = new LocalTime(2, 4, 8, 8);

            Assert.Equal(localTimeResult, localTime.AddMilliseconds(millisecondsToAdd));

            localTime         = new LocalTime(2, 4, 8, 16);
            millisecondsToAdd = -32;
            localTimeResult   = new LocalTime(2, 4, 7, 984);

            Assert.Equal(localTimeResult, localTime.AddMilliseconds(millisecondsToAdd));

            localTime         = new LocalTime(2, 4, 8, 16);
            millisecondsToAdd = -2008;
            localTimeResult   = new LocalTime(2, 4, 6, 8);

            Assert.Equal(localTimeResult, localTime.AddMilliseconds(millisecondsToAdd));
        }