예제 #1
0
        public void DaysTest(double hours, double expectedDays, int expectedDayOfMonth, int expectedWeekDay)
        {
            var dateTime = HenHenTime.FromHours(hours);

            Assert.AreEqual(expectedDays, dateTime.Days);
            Assert.AreEqual(expectedDayOfMonth, dateTime.Day);
            Assert.AreEqual(expectedWeekDay, dateTime.WeekDay);
        }
예제 #2
0
        public void OperatorTest()
        {
            var a = HenHenTime.FromDays(1);
            var b = HenHenTime.FromHours(12);
            var c = new HenHenTime(1, 1, 2);

            Assert.AreEqual(new HenHenTime(1, 1, 2, 12, 0, 0), a + b);
            Assert.AreEqual(new HenHenTime(1, 1, 1, 12, 0, 0), a - b);
            Assert.AreEqual(new HenHenTime(1, 1, 3, 0, 0, 0), a * 2);
            Assert.AreEqual(new HenHenTime(1, 1, 1, 12, 0, 0), a / 2);
            Assert.AreEqual(2, a / b);
            Assert.AreEqual(0.5f, b / a);
            Assert.IsTrue(a != b);
            Assert.IsTrue(a == c);
            Assert.IsTrue(a > b);
            Assert.IsFalse(a < b);
        }