public void ToStringTest_Iso(CultureInfo culture) { var yearMonth = new YearMonth(2022, 1); using (CultureSaver.SetCultures(culture)) { Assert.AreEqual(yearMonth.ToString(culture.DateTimeFormat.YearMonthPattern, culture), yearMonth.ToString()); } }
public void ToStringTest() { var testData = new[] { new { Month = 1, Year = 1, Text = "01/2001" }, new { Month = 12, Year = 2098, Text = "12/2098" }, new { Month = 0, Year = 0, Text = string.Empty }, }; foreach (var td in testData) { var yearMonth = new YearMonth(td.Year, td.Month); Assert.AreEqual(td.Text, yearMonth.ToString()); } }
public override string ToString() { return(type.ToString() + " :" + time.ToString()); }