Пример #1
0
        public void GoYear_SetYear_ShouldntChange()
        {
            TimeWindowCore target = new TimeWindowCore(new DateTime(2010, 4, 10));

            target.GoYear();
            target.GoYear();

            AssertDatesMatch(target,
                             new DateTime(2010, 1, 1),
                             new DateTime(2010, 12, 31),
                             "remains same");
        }
Пример #2
0
        public void GoYear_SetWeek_Goes()
        {
            var target = new TimeWindowCore(new DateTime(2012, 2, 21));

            target.GoWeek();
            target.GoYear();

            AssertDatesMatch(target,
                             new DateTime(2012, 1, 1),
                             new DateTime(2012, 12, 31),
                             "21 Feb will expand to 19 to 25 feb, will change to 2012 year");

            target = new TimeWindowCore(new DateTime(2012, 1, 1));
            target.GoWeek();
            target.GoYear();

            AssertDatesMatch(target,
                             new DateTime(2012, 1, 1),
                             new DateTime(2012, 12, 31),
                             "1st jan was sunday, hence week was 1 to 7, year will remain same");

            target = new TimeWindowCore(new DateTime(2011, 1, 1));
            target.GoWeek();
            target.GoYear();

            AssertDatesMatch(target,
                             new DateTime(2010, 1, 1),
                             new DateTime(2010, 12, 31),
                             "1st jan was saturday, hence week ended in 1st jan, year will become 2010");
        }
Пример #3
0
        public void StartEnd_SetDates_Year()
        {
            TimeWindowCore target = new TimeWindowCore(new DateTime(2011, 4, 10));

            target.GoYear();

            AssertDatesMatch(target,
                             new DateTime(2011, 1, 1),
                             new DateTime(2011, 12, 31),
                             "2011 year");
        }
Пример #4
0
        public void GetUberSpan_SetDates_Year()
        {
            var target = new TimeWindowCore(new DateTime(2012, 1, 1));

            target.GoYear();
            Assert.AreEqual(target.GetUberSpan(), UberSpan.Year);

            target = new TimeWindowCore(new DateTime(2011, 3, 15));
            target.GoYear();
            Assert.AreEqual(target.GetUberSpan(), UberSpan.Year);
        }
Пример #5
0
        public void GoPrevious_SetYear_Goes()
        {
            TimeWindowCore target = new TimeWindowCore(new DateTime(2012, 4, 10));

            target.GoYear();

            target.GoPrevious();
            AssertDatesMatch(target,
                             new DateTime(2011, 1, 1),
                             new DateTime(2011, 12, 31),
                             "2011 year");
        }
Пример #6
0
        public void GoMonth_SetYear_Goes()
        {
            TimeWindowCore target = new TimeWindowCore(new DateTime(2010, 4, 10));

            target.GoYear();
            target.GoMonth();

            AssertDatesMatch(target,
                             new DateTime(2010, 1, 1),
                             new DateTime(2010, 1, 31),
                             "Jan month");
        }
Пример #7
0
        public void GoWeek_SetYear_Goes()
        {
            TimeWindowCore target = new TimeWindowCore(new DateTime(2011, 4, 10));

            target.GoYear();
            target.GoWeek();

            AssertDatesMatch(target,
                             new DateTime(2010, 12, 26),
                             new DateTime(2011, 1, 1),
                             "1st Jan was sat");
        }
Пример #8
0
        public void GoDay_SetYear_Goes()
        {
            TimeWindowCore target = new TimeWindowCore(new DateTime(2011, 4, 10));

            target.GoYear();
            target.GoDay();

            AssertDatesMatch(target,
                             new DateTime(2011, 1, 1),
                             new DateTime(2011, 1, 1),
                             "1st Jan");
        }
Пример #9
0
        public void GoYear_SetMonth_Goes()
        {
            TimeWindowCore target = new TimeWindowCore(new DateTime(2012, 2, 2));

            target.GoMonth();
            target.GoYear();

            AssertDatesMatch(target,
                             new DateTime(2012, 1, 1),
                             new DateTime(2012, 12, 31),
                             "2012 year");
        }
Пример #10
0
        public void GoYear_SetDays_Goes()
        {
            var target = new TimeWindowCore(new DateTime(2007, 2, 10));

            target.GoYear();
            AssertDatesMatch(target,
                             new DateTime(2007, 1, 1),
                             new DateTime(2007, 12, 31),
                             "2007 year");

            target = new TimeWindowCore(new DateTime(2010, 3, 5));
            target.GoYear();
            AssertDatesMatch(target,
                             new DateTime(2010, 1, 1),
                             new DateTime(2010, 12, 31),
                             "2010 year");

            target = new TimeWindowCore(new DateTime(2012, 2, 29));
            target.GoYear();
            AssertDatesMatch(target,
                             new DateTime(2012, 1, 1),
                             new DateTime(2012, 12, 31),
                             "Leap year check. 2012 year");
        }