public void testGetDay() { GEDCOMDate instance = GEDCOMDate.CreateByFormattedStr("20/12/1980", false); byte result = instance.Day; Assert.AreEqual(20, result); }
public void testCreateByFormattedStr_3args() { Assert.AreEqual(null, GEDCOMDate.CreateByFormattedStr(null, GEDCOMCalendar.dcGregorian, false)); Assert.AreEqual("20 DEC 1980", GEDCOMDate.CreateByFormattedStr("20/12/1980", GEDCOMCalendar.dcGregorian, false).StringValue); Assert.AreEqual("DEC 1980", GEDCOMDate.CreateByFormattedStr("__/12/1980", GEDCOMCalendar.dcGregorian, false).StringValue); Assert.AreEqual(null, GEDCOMDate.CreateByFormattedStr("1980", GEDCOMCalendar.dcGregorian, false)); //Assert.Throws(typeof(GEDCOMDateException), () => { GEDCOMDate.createByFormattedStr("1980", GEDCOMCalendar.dcGregorian, true); }); }
public void testCreateByFormattedStr_String_boolean() { Assert.AreEqual(null, GEDCOMDate.CreateByFormattedStr(null, false)); Assert.AreEqual("20 DEC 1980", GEDCOMDate.CreateByFormattedStr("20/12/1980", false).StringValue); Assert.AreEqual("DEC 1980", GEDCOMDate.CreateByFormattedStr("__/12/1980", false).StringValue); Assert.AreEqual(null, GEDCOMDate.CreateByFormattedStr("1980", false)); //Assert.Throws(typeof(GEDCOMDateException), () => { GEDCOMDate.createByFormattedStr("1980", true); }); }
public void testDateChanged() { GEDCOMDate instance = GEDCOMDate.CreateByFormattedStr("31/11/1980", true); //instance.dateChanged(); string result = instance.GetUDN().ToString(); Assert.AreEqual("1980/12/01", result); }
public void testGetMonthNumber() { GEDCOMDate instance = GEDCOMDate.CreateByFormattedStr("20/12/1980", false); int expResult = 12; int result = instance.GetMonthNumber(); Assert.AreEqual(expResult, result); }
public void testGetYear() { GEDCOMDate instance = GEDCOMDate.CreateByFormattedStr("20/01/1980", false); short expResult = 1980; short result = instance.Year; Assert.AreEqual(expResult, result); }
public void testGetMonth() { GEDCOMDate instance = GEDCOMDate.CreateByFormattedStr("20/12/1980", false); string expResult = "DEC"; string result = instance.Month; Assert.AreEqual(expResult, result); }
public void testClear() { GEDCOMDate instance = GEDCOMDate.CreateByFormattedStr("20/01/1980", false); instance.Clear(); string result = instance.StringValue; Assert.AreEqual("", result); }
public void testGetDateCalendar() { GEDCOMDate instance = GEDCOMDate.CreateByFormattedStr("20/12/1980", false); GEDCOMCalendar result = instance.DateCalendar; Assert.AreEqual(GEDCOMCalendar.dcGregorian, result); instance = GEDCOMDate.CreateByFormattedStr("20/12/1980", GEDCOMCalendar.dcJulian, false); result = instance.DateCalendar; Assert.AreEqual(GEDCOMCalendar.dcJulian, result); }
public void testSetMonth() { string value = "DEC"; GEDCOMDate instance = GEDCOMDate.CreateByFormattedStr("20/01/1980", false); instance.Month = value; string result = instance.Month; Assert.AreEqual(value, result); }
public void testSetYearModifier() { string value = "2"; GEDCOMDate instance = GEDCOMDate.CreateByFormattedStr("20/01/1980", false); instance.YearModifier = value; string result = instance.StringValue; Assert.AreEqual("20 JAN 1980/2", result); }
public void testSetYear() { short value = 2001; GEDCOMDate instance = GEDCOMDate.CreateByFormattedStr("20/01/1980", false); instance.Year = value; short result = instance.Year; Assert.AreEqual(value, result); }
public void testGetDisplayString_DateFormat_boolean() { DateFormat format = DateFormat.dfDD_MM_YYYY; bool includeBC = false; GEDCOMDate instance = GEDCOMDate.CreateByFormattedStr("20/12/1980", true); string expResult = "20.12.1980"; string result = instance.GetDisplayString(format, includeBC); Assert.AreEqual(expResult, result); }
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? }
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"); } }
public void testGetDisplayString_DateFormat() { GEDCOMDate instance = GEDCOMDate.CreateByFormattedStr("20/12/1980", true); string expResult = "1980.12.20"; string result = instance.GetDisplayString(DateFormat.dfYYYY_MM_DD); Assert.AreEqual(expResult, result); result = instance.GetDisplayString(DateFormat.dfDD_MM_YYYY); Assert.AreEqual("20.12.1980", result); result = instance.GetDisplayString(DateFormat.dfYYYY); Assert.AreEqual("1980", result); }
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()); }
public void testCreateByFormattedStr_exception() { Assert.Throws(typeof(GEDCOMDateException), () => { GEDCOMDate.CreateByFormattedStr("1.2", true); }); }