Ejemplo n.º 1
0
        public void GoNext_SetWeek_Goes()
        {
            var target = new TimeWindowCore(new DateTime(2012, 2, 20));

            target.GoWeek();
            target.GoNext();
            AssertDatesMatch(target,
                             new DateTime(2012, 2, 26),
                             new DateTime(2012, 3, 3),
                             "19-25 feb week, shifted to 26 - 3 mar");

            target = new TimeWindowCore(new DateTime(2010, 12, 30));
            target.GoWeek();
            target.GoNext();
            AssertDatesMatch(target,
                             new DateTime(2011, 1, 2),
                             new DateTime(2011, 1, 8),
                             "1st jan 2011 was sat, next week is 2-8 jan");

            target = new TimeWindowCore(new DateTime(2012, 1, 13));
            target.GoWeek();
            target.GoNext();
            AssertDatesMatch(target,
                             new DateTime(2012, 1, 15),
                             new DateTime(2012, 1, 21),
                             "Simple happy case");
        }
Ejemplo n.º 2
0
        public void GoNext_SetDays_Goes()
        {
            var target = new TimeWindowCore(new DateTime(2012, 2, 29));

            target.GoNext();
            AssertDatesMatch(target,
                             new DateTime(2012, 3, 1),
                             new DateTime(2012, 3, 1),
                             "Leap year check. Next day is March");

            target = new TimeWindowCore(new DateTime(2012, 2, 15));
            target.GoNext();
            AssertDatesMatch(target,
                             new DateTime(2012, 2, 16),
                             new DateTime(2012, 2, 16),
                             "Simple some inbetween month day");

            target = new TimeWindowCore(new DateTime(2012, 2, 1));
            target.GoNext();
            AssertDatesMatch(target,
                             new DateTime(2012, 2, 2),
                             new DateTime(2012, 2, 2),
                             "1st day of month");

            target = new TimeWindowCore(new DateTime(2012, 12, 31));
            target.GoNext();
            AssertDatesMatch(target,
                             new DateTime(2013, 1, 1),
                             new DateTime(2013, 1, 1),
                             "last day of year");
        }
Ejemplo n.º 3
0
        public void GoNext_SetYear_Goes()
        {
            TimeWindowCore target = new TimeWindowCore(new DateTime(2010, 4, 10));

            target.GoYear();

            target.GoNext();
            AssertDatesMatch(target,
                             new DateTime(2011, 1, 1),
                             new DateTime(2011, 12, 31),
                             "2011 year");
        }
Ejemplo n.º 4
0
        public void GoNext_SetMonth_Goes()
        {
            TimeWindowCore target = new TimeWindowCore(new DateTime(2012, 1, 2));

            target.GoMonth();
            target.GoNext();
            AssertDatesMatch(target,
                             new DateTime(2012, 2, 1),
                             new DateTime(2012, 2, 29),
                             "End date 31 jan. add month? 29 feb");

            target.GoNext();
            AssertDatesMatch(target,
                             new DateTime(2012, 3, 1),
                             new DateTime(2012, 3, 31),
                             "end date 29 feb 2012 -> march");

            target.GoNext();
            AssertDatesMatch(target,
                             new DateTime(2012, 4, 1),
                             new DateTime(2012, 4, 30),
                             "end date 30 april 2012");
        }