Пример #1
0
        private static int GetfirstDayGridColumnIndex()
        {
            DateTime displayedDate            = DateUtilities.DisplayedDate;
            DateTime firstDayOfDisplayedMonth = new DateTime(displayedDate.Year, displayedDate.Month, firstDayNumberInMonth);
            int      firstDayGridColumnIndex  = DateUtilities.GetDayNumberInWeek(firstDayOfDisplayedMonth) - gridColumnIndexOffset;

            return(firstDayGridColumnIndex);
        }
Пример #2
0
 private void GenerateDayColumnElements()
 {
     dayColumns = new List <WeekColumn>();
     for (int dayNumberInWeek = 1; dayNumberInWeek <= DateUtilities.DaysInWeek; dayNumberInWeek++)
     {
         DateTime   displayedDate          = DateUtilities.DisplayedDate;
         int        displayedDateDayOfWeek = DateUtilities.GetDayNumberInWeek(displayedDate);
         int        daysFromDisplayedDate  = DateUtilities.NegativeMultiplier * displayedDateDayOfWeek + dayNumberInWeek;
         DateTime   dayColumnDate          = displayedDate.AddDays(daysFromDisplayedDate);
         WeekColumn weekColumnElement      = new WeekColumn(dayColumnDate, dayNumberInWeek, sourceSessionController);
         weekColumnElement.SetValue(Grid.ColumnProperty, dayNumberInWeek);
         dayColumns.Add(weekColumnElement);
     }
 }
        public void GetDayNumberInWeek_WednesdayDateTime_ReturnsThree()
        {
            int expectedDayNumber = 3;

            Assert.AreEqual(expectedDayNumber, DateUtilities.GetDayNumberInWeek(aWednesday));
        }
        public void GetDayNumberInWeek_TuesdayDateTime_ReturnsTwoo()
        {
            int expectedDayNumber = 2;

            Assert.AreEqual(expectedDayNumber, DateUtilities.GetDayNumberInWeek(aTuesday));
        }
        public void GetDayNumberInWeek_MondayDateTime_ReturnsOne()
        {
            int expectedDayNumber = 1;

            Assert.AreEqual(expectedDayNumber, DateUtilities.GetDayNumberInWeek(aMonday));
        }
        public void GetDayNumberInWeek_SundayDateTime_ReturnsSeven()
        {
            int expectedDayNumber = 7;

            Assert.AreEqual(expectedDayNumber, DateUtilities.GetDayNumberInWeek(aSunday));
        }
        public void GetDayNumberInWeek_SaturdayDateTime_ReturnsSix()
        {
            int expectedDayNumber = 6;

            Assert.AreEqual(expectedDayNumber, DateUtilities.GetDayNumberInWeek(aSaturday));
        }
        public void GetDayNumberInWeek_FridayDateTime_ReturnsFive()
        {
            int expectedDayNumber = 5;

            Assert.AreEqual(expectedDayNumber, DateUtilities.GetDayNumberInWeek(aFriday));
        }
        public void GetDayNumberInWeek_ThursdayDateTime_ReturnsFour()
        {
            int expectedDayNumber = 4;

            Assert.AreEqual(expectedDayNumber, DateUtilities.GetDayNumberInWeek(aThursday));
        }