コード例 #1
0
        public void AddMilliSecondsTest()
        {
            var t1 = new Time(0, 0, 0, 0);

            t1.AddMilliSeconds(500);
            var t2 = new Time(0, 0, 0, 500);

            Assert.AreEqual(t2, t1);

            t1 = new Time(23, 59, 59, 500);
            t1.AddMilliSeconds(500);
            t2 = new Time(0, 0, 0, 0);
            Assert.AreEqual(t2, t1);

            t1 = new Time(0, 0, 0, 0);
            t1.AddMilliSeconds(1000);
            t2 = new Time(0, 0, 1, 0);
            Assert.AreEqual(t2, t1);

            t1 = new Time(0, 0, 0, 500);
            t1.AddMilliSeconds(500);
            t2 = new Time(0, 0, 1, 0);
            Assert.AreEqual(t2, t1);

            t1 = new Time(0, 0, 1, 0);
            t1.AddMilliSeconds(-1000);
            t2 = new Time(0, 0, 0, 0);
            Assert.AreEqual(t2, t1);

            t1 = new Time(0, 0, 0, 500);
            t1.AddMilliSeconds(-1000);
            t2 = new Time(23, 59, 59, 500);
            Assert.AreEqual(t2, t1);
        }