Example #1
0
 private void AssertDateUTC(DateTime dt, int year, int month, int day, int hours, int minutes, int seconds, int milliseconds)
 {
     Assert.AreEqual(dt.GetUtcFullYear(), year);
     Assert.AreEqual(dt.GetUtcMonth(), month);
     Assert.AreEqual(dt.GetUtcDate(), day);
     Assert.AreEqual(dt.GetUtcHours(), hours);
     Assert.AreEqual(dt.GetUtcMinutes(), minutes);
     Assert.AreEqual(dt.GetUtcSeconds(), seconds);
     Assert.AreEqual(dt.GetUtcMilliseconds(), milliseconds);
 }
Example #2
0
 public void ToUniversalWorks()
 {
     var dt = new DateTime(2011, 7, 12, 13, 42, 56, 345);
     var UTC = dt.ToUniversalTime();
     Assert.AreEqual(dt.GetUtcFullYear(), UTC.GetFullYear());
     Assert.AreEqual(dt.GetUtcMonth(), UTC.GetMonth());
     Assert.AreEqual(dt.GetUtcDate(), UTC.GetDate());
     Assert.AreEqual(dt.GetUtcHours(), UTC.GetHours());
     Assert.AreEqual(dt.GetUtcMinutes(), UTC.GetMinutes());
     Assert.AreEqual(dt.GetUtcSeconds(), UTC.GetSeconds());
     Assert.AreEqual(dt.GetUtcMilliseconds(), UTC.GetMilliseconds());
 }
Example #3
0
 public void GetUTCFullYearWorks()
 {
     var dt = new DateTime(DateTime.Utc(2011, 7, 12, 13, 42, 56, 345));
     Assert.AreEqual(dt.GetUtcFullYear(), 2011);
 }
		public void ToUniversalWorks() {
			var dt = new DateTime(2011, 7, 12, 13, 42, 56, 345);
			var utc = dt.ToUniversalTime();
			Assert.AreEqual(dt.GetUtcFullYear(), utc.Year);
			Assert.AreEqual(dt.GetUtcMonth(), utc.Month);
			Assert.AreEqual(dt.GetUtcDate(), utc.Day);
			Assert.AreEqual(dt.GetUtcHours(), utc.Hour);
			Assert.AreEqual(dt.GetUtcMinutes(), utc.Minute);
			Assert.AreEqual(dt.GetUtcSeconds(), utc.Second);
			Assert.AreEqual(dt.GetUtcMilliseconds(), utc.Millisecond);
		}