Esempio n. 1
0
        public void TestFromStringWithStringFormat()
        {
            var d = QDate.FromString("1MM12car2003", "d'MM'MMcaryyyy");

            Assert.AreEqual(1, d.Day);
            Assert.AreEqual(12, d.Month);
            Assert.AreEqual(2003, d.Year);
        }
Esempio n. 2
0
        public void TestFromStringWithDateFormat()
        {
            var f = DateFormat.ISODate;
            var d = QDate.FromString("2014-09-20", f);

            Assert.AreEqual(20, d.Day);
            Assert.AreEqual(09, d.Month);
            Assert.AreEqual(2014, d.Year);
        }
Esempio n. 3
0
        public void testQDateFromString()
        {
            Assert.AreEqual(new QDate(-1645), QDate.FromString("1995.07.01"));
            Assert.AreEqual(new QDate(-365), QDate.FromString("1999.01.01"));
            Assert.AreEqual(new QDate(0), QDate.FromString("2000.01.01"));
            Assert.AreEqual(new QDate(2008), QDate.FromString("2005.07.01"));
            Assert.AreEqual(new QDate(3653), QDate.FromString("2010.01.01"));

            Assert.AreEqual(new QDate(int.MinValue), QDate.FromString(null));
            Assert.AreEqual(new QDate(int.MinValue), QDate.FromString(""));
            Assert.AreEqual(new QDate(int.MinValue), QDate.FromString("0Nd"));
        }
Esempio n. 4
0
        public void TestFromStringWithInvalidStringFormatReturningDefaultValues()
        {
            var d1 = QDate.FromString("1.30", "M.d");

            Assert.AreEqual(30, d1.Day);
            Assert.AreEqual(1, d1.Month);
            Assert.AreEqual(1900, d1.Year);

            var d2 = QDate.FromString("20000110", "yyyyMMdd");

            Assert.AreEqual(10, d2.Day);
            Assert.AreEqual(1, d2.Month);
            Assert.AreEqual(2000, d2.Year);

            var d3 = QDate.FromString("20000110", "yyyyMd");

            Assert.AreEqual(10, d3.Day);
            Assert.AreEqual(1, d3.Month);
            Assert.AreEqual(2000, d3.Year);
        }