Пример #1
0
        public void FromUnixTimestampAndOverloads()
        {
            var unix1 = (UtcDate - new DateTime(1970, 1, 1, 0, 0, 0, 0, DateTimeKind.Utc)).TotalSeconds.TryParseLong();
            var unix2 = (LocalDate.ToUtc(LocalTimeZoneInfo) - new DateTime(1970, 1, 1, 0, 0, 0, 0, DateTimeKind.Utc)).TotalSeconds.TryParseLong();

            Assert.AreEqual(UtcDate.ToString("g"), unix1.FromUnixTimestamp().ToTimezoneDate(LocalTimeZoneInfo, UtcTimeZoneInfo).ToString("g"));

            Assert.AreEqual(LocalDate.ToString("g"), unix2.FromUnixTimestamp().ToTimezoneDate(UtcTimeZoneInfo, LocalTimeZoneInfo).ToString("g"));
        }
        public Dictionary <string, string> GenerateProperties()
        {
            var answer = new Dictionary <string, string>()
            {
                { "Date", UtcDate.ToString("yyyy-MM-dd") }, // ISO8601 format
                { "AccountId", UserId } // We have to add AccountId, since if it changed, the AccountId automatically logged would be different
            };

            // Entries0 - Entries17
            for (int i = 0; i < _pageProperties.Count; i++)
            {
                answer.Add($"Entries{i}", _pageProperties[i]);
            }

            return(answer);
        }
Пример #3
0
 public void ToUtcAndOverloads()
 {
     Assert.AreEqual(UtcDate.ToString("g"), LocalDate.ToUtc().ToString("g"));
     Assert.AreEqual(UtcDate.ToString("g"), LocalDate.ToUtc(UtcTimeZoneInfo).ToString("g"));
     Assert.AreEqual(UtcDate.ToString("g"), LocalDate.ToUtc(UtcTimeZoneName).ToString("g"));
 }