Esempio n. 1
0
            public void UndefinedTzIsUtc_ArgIsUtc_ResultIsUtc()
            {
                DateTime     source = new DateTime(2013, 1, 29, 13, 28, 21, 1, DateTimeKind.Utc);
                TimeZoneInfo tz     = null;
                var          html   = CreateHtmlHelper(new ViewDataDictionary());

                html.SetTimezone(tz);

                DateTime utcResult;
                var      result = SrkHtmlExtensions.GetUserDate(html, source, out utcResult);

                Assert.AreEqual(source, result);
                Assert.AreEqual(source, utcResult);
            }
Esempio n. 2
0
            public void RomanceTz_ArgIsUtc_ResultIsRomance()
            {
                TimeZoneInfo tz     = TimeZoneInfo.FindSystemTimeZoneById("Romance Standard Time");
                DateTime     orig   = new DateTime(2013, 1, 29, 13, 28, 21, 1, DateTimeKind.Utc);
                DateTime     source = tz.ConvertFromUtc(orig);
                var          html   = CreateHtmlHelper(new ViewDataDictionary());

                html.SetTimezone(tz);

                DateTime utcResult;
                var      result = SrkHtmlExtensions.GetUserDate(html, source, out utcResult);

                Assert.AreEqual(source, result, "wrong user result");
                Assert.AreEqual(orig, utcResult, "wrong UTC result");
            }