Exemple #1
0
 public void DataTypes_DateHelpers_weekOfyear()
 {
     Assert.AreEqual(1, TimexDateHelpers.WeekOfYear(new System.DateTime(2017, 1, 1)));
     Assert.AreEqual(2, TimexDateHelpers.WeekOfYear(new System.DateTime(2017, 1, 2)));
     Assert.AreEqual(9, TimexDateHelpers.WeekOfYear(new System.DateTime(2017, 2, 23)));
     Assert.AreEqual(12, TimexDateHelpers.WeekOfYear(new System.DateTime(2017, 3, 15)));
     Assert.AreEqual(40, TimexDateHelpers.WeekOfYear(new System.DateTime(2017, 9, 25)));
     Assert.AreEqual(53, TimexDateHelpers.WeekOfYear(new System.DateTime(2017, 12, 31)));
     Assert.AreEqual(1, TimexDateHelpers.WeekOfYear(new System.DateTime(2018, 1, 1)));
     Assert.AreEqual(1, TimexDateHelpers.WeekOfYear(new System.DateTime(2018, 1, 2)));
     Assert.AreEqual(1, TimexDateHelpers.WeekOfYear(new System.DateTime(2018, 1, 7)));
     Assert.AreEqual(2, TimexDateHelpers.WeekOfYear(new System.DateTime(2018, 1, 8)));
 }
Exemple #2
0
        public void DataTypes_DateHelpers_invariance()
        {
            var d      = new System.DateTime(2017, 8, 25);
            var before = d;

            TimexDateHelpers.Tomorrow(d);
            TimexDateHelpers.Yesterday(d);
            TimexDateHelpers.DatePartEquals(new System.DateTime(), d);
            TimexDateHelpers.DatePartEquals(d, new System.DateTime());
            TimexDateHelpers.IsNextWeek(d, new System.DateTime());
            TimexDateHelpers.IsNextWeek(new System.DateTime(), d);
            TimexDateHelpers.IsLastWeek(new System.DateTime(), d);
            TimexDateHelpers.WeekOfYear(d);
            var after = d;

            Assert.AreEqual(after, before);
        }