Ejemplo n.º 1
0
        public void IsValidValidatesProperly()
        {
            Assert.IsFalse(GregorianDate.IsValid(2000, 0, 1, 0, 0, 0));
            Assert.IsTrue(GregorianDate.IsValid(2000, 1, 1, 0, 0, 0));
            Assert.IsTrue(GregorianDate.IsValid(2000, 2, 1, 0, 0, 0));
            Assert.IsTrue(GregorianDate.IsValid(2000, 3, 1, 0, 0, 0));
            Assert.IsTrue(GregorianDate.IsValid(2000, 4, 1, 0, 0, 0));
            Assert.IsTrue(GregorianDate.IsValid(2000, 5, 1, 0, 0, 0));
            Assert.IsTrue(GregorianDate.IsValid(2000, 6, 1, 0, 0, 0));
            Assert.IsTrue(GregorianDate.IsValid(2000, 7, 1, 0, 0, 0));
            Assert.IsTrue(GregorianDate.IsValid(2000, 8, 1, 0, 0, 0));
            Assert.IsTrue(GregorianDate.IsValid(2000, 9, 1, 0, 0, 0));
            Assert.IsTrue(GregorianDate.IsValid(2000, 10, 1, 0, 0, 0));
            Assert.IsTrue(GregorianDate.IsValid(2000, 11, 1, 0, 0, 0));
            Assert.IsTrue(GregorianDate.IsValid(2000, 12, 1, 0, 0, 0));
            Assert.IsFalse(GregorianDate.IsValid(2000, 13, 1, 0, 0, 0));

            Assert.IsFalse(GregorianDate.IsValid(2000, 1, 1, -1, 0, 0));
            Assert.IsTrue(GregorianDate.IsValid(2000, 1, 1, 0, 0, 0));
            Assert.IsTrue(GregorianDate.IsValid(2000, 1, 1, 23, 0, 0));
            Assert.IsFalse(GregorianDate.IsValid(2000, 1, 1, 24, 0, 0));

            Assert.IsFalse(GregorianDate.IsValid(2000, 1, 1, 6, -1, 0));
            Assert.IsTrue(GregorianDate.IsValid(2000, 1, 1, 6, 0, 0));
            Assert.IsTrue(GregorianDate.IsValid(2000, 1, 1, 6, 59, 0));
            Assert.IsFalse(GregorianDate.IsValid(2000, 1, 1, 6, 60, 0));

            Assert.IsFalse(GregorianDate.IsValid(2000, 1, 1, 6, 0, -1));
            Assert.IsTrue(GregorianDate.IsValid(2000, 1, 1, 6, 0, 0));
            Assert.IsTrue(GregorianDate.IsValid(2000, 1, 1, 6, 0, 0.00001));
            Assert.IsTrue(GregorianDate.IsValid(2000, 1, 1, 6, 0, 59));
            Assert.IsTrue(GregorianDate.IsValid(2000, 1, 1, 6, 0, 59.9));
            Assert.IsFalse(GregorianDate.IsValid(2000, 1, 1, 6, 0, 60));
        }
Ejemplo n.º 2
0
        public void TestSixtySecondsAreNotValidIfTheInstantDoesNotRepresentALeapSecond()
        {
            //12/30/2008 was not the day of a leap second day.
            Assert.IsFalse(GregorianDate.IsValid(2008, 12, 30, 23, 59, 60));

            //23:58 is one minute before a valid leap second.
            Assert.IsFalse(GregorianDate.IsValid(2008, 12, 31, 23, 58, 60));
        }
Ejemplo n.º 3
0
 public void TestSixtySecondsAreValidIfTheInstantRepresentsALeapSecond()
 {
     Assert.IsTrue(GregorianDate.IsValid(2008, 12, 31, 23, 59, 60));
     Assert.IsTrue(GregorianDate.IsValid(2008, 12, 31, 23, 59, 60.999));
 }