Example #1
0
        public void WeekTest()
        {
            DateTime now = ClockProxy.Clock.Now;

            DateTime week = Now.Week(now.DayOfWeek);

            Assert.Equal(week.Year, now.Year);
            Assert.Equal(week.Month, now.Month);
            Assert.Equal(week.Day, now.Day);
            Assert.Equal(week.DayOfWeek, now.DayOfWeek);
            Assert.Equal(0, week.Hour);
            Assert.Equal(0, week.Minute);
            Assert.Equal(0, week.Second);
            Assert.Equal(0, week.Millisecond);

            DayOfWeek previousDay  = TimeTool.PreviousDay(now.DayOfWeek);
            DateTime  previousWeek = Now.Week(previousDay);

            Assert.Equal(previousWeek.Year, now.AddDays(-1).Year);
            Assert.Equal(previousWeek.Month, now.AddDays(-1).Month);
            Assert.Equal(previousWeek.Day, now.AddDays(-1).Day);
            Assert.Equal(previousWeek.DayOfWeek, previousDay);
            Assert.Equal(0, previousWeek.Hour);
            Assert.Equal(0, previousWeek.Minute);
            Assert.Equal(0, previousWeek.Second);
            Assert.Equal(0, previousWeek.Millisecond);
        } // WeekTest