예제 #1
0
        public void testDateChanged()
        {
            GEDCOMDate instance = GEDCOMDate.CreateByFormattedStr("31/11/1980", true);
            //instance.dateChanged();
            string result = instance.GetUDN().ToString();

            Assert.AreEqual("1980/12/01", result);
        }
예제 #2
0
        public void testGetUDN()
        {
            GEDCOMDate instance  = GEDCOMDate.CreateByFormattedStr("20/12/1980", true);
            UDN        expResult = new UDN(UDNCalendarType.ctGregorian, 1980, 12, 20);
            UDN        result    = instance.GetUDN();
            bool       resu2     = expResult.Equals(result);

            Assert.IsTrue(resu2);
            Assert.AreEqual(expResult, result); // TODO Assert.AreEqual supposedly invokes .equals(), so why does this fail?
        }
예제 #3
0
        public override UDN GetUDN()
        {
            UDN result;

            if (fDateFrom.StringValue != "" && fDateTo.StringValue == "")
            {
                result = UDN.CreateAfter(fDateFrom.GetUDN());
            }
            else if (fDateFrom.StringValue == "" && fDateTo.StringValue != "")
            {
                result = UDN.CreateBefore(fDateTo.GetUDN());
            }
            else if (fDateFrom.StringValue != "" && fDateTo.StringValue != "")
            {
                result = UDN.CreateBetween(fDateFrom.GetUDN(), fDateTo.GetUDN());
            }
            else
            {
                result = UDN.CreateEmpty();
            }

            return(result);
        }
예제 #4
0
        public static UDN GetUDNByFormattedStr(string dateStr, GEDCOMCalendar calendar, bool aException = false)
        {
            GEDCOMDate dtx = GEDCOMDate.CreateByFormattedStr(dateStr, calendar, aException);

            return((dtx != null) ? dtx.GetUDN() : UDN.CreateEmpty());
        }