public GDMSourceEvent(GDMObject owner) : base(owner) { SetName(GEDCOMTagType.EVEN); fDate = new GDMDatePeriod(this); fPlace = new GDMPlace(this); }
public GDMSourceEvent() { SetName(GEDCOMTagType.EVEN); fDate = new GDMDatePeriod(); fPlace = new GDMPlace(); }
public static GDMDatePeriod CreatePeriod(GDMObject owner, GDMDate dateFrom, GDMDate dateTo) { GDMDatePeriod result = new GDMDatePeriod(owner); if (dateFrom != null) { result.DateFrom.Assign(dateFrom); } if (dateTo != null) { result.DateTo.Assign(dateTo); } return(result); }
public void Test_Common() { using (GDMDatePeriod dtx1 = new GDMDatePeriod()) { Assert.IsNotNull(dtx1, "dtx1 != null"); Assert.AreEqual("", dtx1.StringValue); Assert.AreEqual(new DateTime(0), dtx1.GetDateTime()); Assert.AreEqual("", dtx1.GetDisplayStringExt(DateFormat.dfYYYY_MM_DD, true, true)); // date is empty UDN udn = dtx1.GetUDN(); Assert.IsTrue(udn.IsEmpty()); dtx1.ParseString("FROM 04 JAN 2013 TO 23 JAN 2013"); Assert.AreEqual("FROM 04 JAN 2013 TO 23 JAN 2013", dtx1.StringValue); Assert.AreEqual(new DateTime(0), dtx1.Date); Assert.AreEqual("2013.01.04 [G] - 2013.01.23 [G]", dtx1.GetDisplayStringExt(DateFormat.dfYYYY_MM_DD, true, true)); udn = dtx1.GetUDN(); Assert.IsFalse(udn.IsEmpty()); dtx1.ParseString("FROM 04 JAN 2013 TO 04 JAN 2013"); Assert.AreEqual("FROM 04 JAN 2013 TO 04 JAN 2013", dtx1.StringValue); Assert.AreEqual(TestUtils.ParseDT("04.01.2013"), dtx1.Date); udn = dtx1.GetUDN(); Assert.IsFalse(udn.IsEmpty()); dtx1.Clear(); dtx1.ParseString("FROM 04 JAN 2013"); Assert.AreEqual("FROM 04 JAN 2013", dtx1.StringValue); Assert.AreEqual(TestUtils.ParseDT("04.01.2013"), dtx1.Date); Assert.AreEqual("2013.01.04 [G] >", dtx1.GetDisplayStringExt(DateFormat.dfYYYY_MM_DD, true, true)); udn = dtx1.GetUDN(); Assert.IsFalse(udn.IsEmpty()); dtx1.Clear(); dtx1.ParseString("TO 23 JAN 2013"); Assert.AreEqual("TO 23 JAN 2013", dtx1.StringValue); Assert.AreEqual(TestUtils.ParseDT("23.01.2013"), dtx1.Date); Assert.AreEqual("< 2013.01.23 [G]", dtx1.GetDisplayStringExt(DateFormat.dfYYYY_MM_DD, true, true)); udn = dtx1.GetUDN(); Assert.IsFalse(udn.IsEmpty()); Assert.Throws(typeof(NotSupportedException), () => { dtx1.SetDateTime(DateTime.Now); }); Assert.AreEqual(string.Empty, dtx1.ParseString(null)); } }