public void ErinnTimeToString() { var time1 = new ErinnTime(DateTime.Parse("2015-01-01 00:00")); Assert.Equal("550-4-01 00:00", time1.ToString()); Assert.Equal("0550-04-01 0:0", time1.ToString("yyyy-MM-dd H:m")); Assert.Equal("00:00 AM", time1.ToString("HH:mm tt")); var time2 = new ErinnTime(DateTime.Parse("2015-01-01 23:59")); Assert.Equal("23:20 PM", time2.ToString("HH:mm tt")); }
public void ErinnTimeToString() { var time1 = new ErinnTime(DateTime.Parse("2015-01-01 00:00")); Assert.Equal("550-4-01 00:00", time1.ToString()); Assert.Equal("0550-04-01 0:0", time1.ToString("yyyy-MM-dd H:m")); Assert.Equal("00:00 AM", time1.ToString("HH:mm tt")); Assert.Equal("01 Lughnasadh 550", time1.ToString("dd MMMM yyy")); ErinnTime.SetMonthNames("0", "1", "2", "3", "Foobar", "5", "6"); Assert.Equal("01 Foobar 550", time1.ToString("dd MMMM yyy")); var time2 = new ErinnTime(DateTime.Parse("2015-01-01 23:59")); Assert.Equal("23:20 PM", time2.ToString("HH:mm tt")); }
public void ErinnTimeToString() { var time1 = new ErinnTime(DateTime.Parse("2015-01-01 00:00")); Assert.Equal("550-5-01 00:00", time1.ToString()); Assert.Equal("0550-05-01 0:0", time1.ToString("yyyy-MM-dd H:m")); Assert.Equal("00:00 AM", time1.ToString("HH:mm tt")); Assert.Equal("01 Lughnasadh 550", time1.ToString("dd MMMM yyy")); ErinnTime.SetMonthNames("0", "1", "2", "3", "Foobar", "5", "6"); Assert.Equal("01 Foobar 550", time1.ToString("dd MMMM yyy")); var time2 = new ErinnTime(DateTime.Parse("2015-01-01 23:59")); Assert.Equal("23:20 PM", time2.ToString("HH:mm tt")); var dt3 = DateTime.Parse("2016-06-26 00:00"); for (int year = 0; year < 2; ++year) { for (int month = 0; month < 7; ++month) { for (int day = 0; day < 40; ++day) { for (int hour = 0; hour < 24; ++hour) { for (int minute = 0; minute < 60; ++minute) { var time = new ErinnTime(dt3.AddMilliseconds((year * (7 * 40 * 24 * 60 * 1500)) + (month * (40 * 24 * 60 * 1500)) + (day * (24 * 60 * 1500)) + (hour * (60 * 1500)) + (minute * 1500))); Assert.Equal(string.Format("{0}-{1}-{2:00} {3:00}:{4:00}", 628 + year, month + 1, day + 1, hour, minute), time.ToString()); } } } } } }
public void BeginOfTimeCap() { var time1 = new ErinnTime(ErinnTime.BeginOfTime); Assert.Equal("1-1-01 00:00", time1.ToString()); var time2 = new ErinnTime(DateTime.MinValue); Assert.Equal("1-1-01 00:00", time2.ToString()); var time3 = new ErinnTime(new DateTime(2000, 1, 1)); Assert.Equal("1-1-01 00:00", time3.ToString()); var time4 = new ErinnTime(DateTime.MaxValue); Assert.Equal("417187-6-40 23:59", time4.ToString()); }