public void UserIsUtc_ArgIsUtc_ResultIsUtc() { Thread.CurrentThread.CurrentCulture = TestCulture1; DateTime source = new DateTime(2013, 1, 29, 13, 28, 21, 1, DateTimeKind.Utc); TimeZoneInfo tz = null; string expected = "<time datetime=\"2013-01-29T13:28:21.0010000Z\" title=\"29/01/2013 13:28:21\" class=\"past not-today display-datetime\">29 January 2013 13:28:21</time>"; var html = CreateHtmlHelper(new ViewDataDictionary()); html.SetTimezone(tz); var result = SrkHtmlExtensions.DisplayDateTime(html, source); Assert.AreEqual(expected, result.ToString()); }
public void UserIsRomance_ArgIsUser_ResultIsRomance() { Thread.CurrentThread.CurrentCulture = TestCulture1; TimeZoneInfo tz = TimeZoneInfo.FindSystemTimeZoneById("Romance Standard Time"); DateTime source = new DateTime(2013, 1, 29, 13, 28, 21, 1, DateTimeKind.Unspecified); DateTime utc = tz.ConvertToUtc(source); Debug.Assert(source.Kind == DateTimeKind.Unspecified); string expected = "<time datetime=\"2013-01-29T12:28:21.0010000Z\" title=\"29/01/2013 13:28:21\" class=\"past not-today display-datetime\">29 January 2013 13:28:21</time>"; var html = CreateHtmlHelper(new ViewDataDictionary()); html.SetTimezone(tz); var result = SrkHtmlExtensions.DisplayDateTime(html, source); Assert.AreEqual(expected, result.ToString()); }