Esempio n. 1
0
        public override DateTime GetDateTime()
        {
            DateTime result;

            if (fDateFrom.IsEmpty())
            {
                result = fDateTo.GetDateTime();
            }
            else
            {
                if (fDateTo.IsEmpty())
                {
                    result = fDateFrom.GetDateTime();
                }
                else
                {
                    if (fDateFrom.GetDateTime() == fDateTo.GetDateTime())
                    {
                        result = fDateFrom.GetDateTime();
                    }
                    else
                    {
                        result = new DateTime(0);
                    }
                }
            }
            return(result);
        }
Esempio n. 2
0
        public void testGetDateTime()
        {
            GEDCOMDate instance = GEDCOMDate.CreateByFormattedStr("20/01/1980", false);
            DateTime   expResult;

            try {
                expResult = ParseDT("1980-01-20");
                DateTime result = instance.GetDateTime();
                Assert.AreEqual(expResult, result);
            } catch (Exception) {
                Assert.Fail("Parse exception for date");
            }
        }
Esempio n. 3
0
        public void testSetDateTime()
        {
            GEDCOMDate instance = new GEDCOMDate(null, null, "", "");
            DateTime   expResult;

            try {
                expResult = ParseDT("1980-01-20");
                instance.SetDateTime(expResult);
                Assert.AreEqual(expResult, instance.GetDateTime());
            } catch (Exception) {
                Assert.Fail("Parse exception for date");
            }
        }
Esempio n. 4
0
        public override DateTime GetDateTime()
        {
            DateTime result;

            if (fDateAfter.IsEmpty())
            {
                result = fDateBefore.GetDateTime();
            }
            else
            {
                if (fDateBefore.IsEmpty())
                {
                    result = fDateAfter.GetDateTime();
                }
                else
                {
                    result = new DateTime(0);
                }
            }
            return(result);
        }