Exemplo n.º 1
0
		public void YMDHConstructorWorks() {
			var dt = new JsDate(2011, 7, 12, 13);
			Assert.AreEqual(dt.GetFullYear(), 2011);
			Assert.AreEqual(dt.GetMonth(), 7);
			Assert.AreEqual(dt.GetDate(), 12);
			Assert.AreEqual(dt.GetHours(), 13);
		}
Exemplo n.º 2
0
		public void YMDHNSConstructorWorks() {
			var dt = new JsDate(2011, 7, 12, 13, 42, 56);
			Assert.AreEqual(dt.GetFullYear(), 2011);
			Assert.AreEqual(dt.GetMonth(), 7);
			Assert.AreEqual(dt.GetDate(), 12);
			Assert.AreEqual(dt.GetHours(), 13);
			Assert.AreEqual(dt.GetMinutes(), 42);
			Assert.AreEqual(dt.GetSeconds(), 56);
		}
Exemplo n.º 3
0
 public void ConvertingMutableDateToDateReturnsANewButEqualInstance()
 {
     var mdt = new JsDate(2011, 7, 12);
     DateTime dt = (DateTime)mdt;
     Assert.IsFalse((object)dt == (object)mdt);
     Assert.AreEqual(mdt.GetFullYear(), 2011);
     Assert.AreEqual(mdt.GetMonth(), 7);
     Assert.AreEqual(mdt.GetDate(), 12);
 }
Exemplo n.º 4
0
        public void SetMonthWorks() {
			var dt = new JsDate(2000, 0, 1);
			dt.SetMonth(3);
			Assert.AreEqual(dt.GetMonth(), 3);
        }
Exemplo n.º 5
0
        public void SetFullYearWithThreeParametersWorks() {
			var dt = new JsDate(2000, 0, 1);
			dt.SetFullYear(2021, 7, 13);
			Assert.AreEqual(dt.GetFullYear(), 2021);
			Assert.AreEqual(dt.GetMonth(), 7);
			Assert.AreEqual(dt.GetDate(), 13);
        }
Exemplo n.º 6
0
		public void StringConstructorWorks() {
			var dt = new JsDate("Aug 12, 2012");
			Assert.AreEqual(dt.GetFullYear(), 2012);
			Assert.AreEqual(dt.GetMonth(), 7);
			Assert.AreEqual(dt.GetDate(), 12);
		}
Exemplo n.º 7
0
		public void GetMonthWorks() {
			var dt = new JsDate(2011, 7, 12, 13, 42, 56, 345);
			Assert.AreEqual(dt.GetMonth(), 7);
		}
Exemplo n.º 8
0
		public void ToLocalWorks() {
			var utc = new JsDate(2011, 7, 12, 13, 42, 56, 345);
			var dt = utc.ToLocalTime();
			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());
		}