public void ClickHeaderCommandTest()
 {
     DateTime date = new DateTime(2010, 1, 1);
     SchedulerDayModel day = new SchedulerDayModel(new SchedulerDisplayInfo(new CultureInfo("cs-CZ")), date);
     SchedulerMonthDayHeaderViewModel target = new SchedulerMonthDayHeaderViewModel(null, day);
     Assert.IsInstanceOfType(target.ClickHeaderCommand, typeof(ICommand), "ClickHeaderCommand should return ICommand object.");
 }
Exemplo n.º 2
0
        private void InitDayCells(List <SchedulerBaseElementViewModel> elementList)
        {
            int row = 1;

            foreach (SchedulerWeekModel week in month.Weeks)
            {
                int col = 1;
                foreach (SchedulerDayModel day in week.Days)
                {
                    SchedulerMonthDayHeaderViewModel header = new SchedulerMonthDayHeaderViewModel(scheduler, day);
                    header.Column = col;
                    header.Row    = row;
                    elementList.Add(header);

                    SchedulerMonthDayBodyViewModel body = new SchedulerMonthDayBodyViewModel(day);
                    body.Column = col;
                    body.Row    = row + 1;
                    elementList.Add(body);

                    col += 1;
                }
                row += 2;
            }
        }
        public void ClickHeaderTest()
        {
            DaySelected dayNotify = new DaySelected();
            DateTime date = new DateTime(2010, 1, 1);
            SchedulerDayModel day = new SchedulerDayModel(new SchedulerDisplayInfo(new CultureInfo("cs-CZ")), date);
            day.SetDate(date);
            SchedulerMonthDayHeaderViewModel target = new SchedulerMonthDayHeaderViewModel(dayNotify, day);

            Assert.IsNull(dayNotify.Day, "Day should be null.");

            ICommand command = target.ClickHeaderCommand;
            command.Execute(null);

            Assert.IsNotNull(dayNotify.Day, "Day should be assigned.");
            Assert.AreEqual(date, dayNotify.Day.Date, "Date should be 1/1/2010.");
        }
        public void MonthTest()
        {
            DateTime date = new DateTime(2010, 1, 1);
            SchedulerDayModel day = new SchedulerDayModel(new SchedulerDisplayInfo(new CultureInfo("cs-CZ")), date);
            day.SetDate(date);
            SchedulerMonthDayHeaderViewModel target = new SchedulerMonthDayHeaderViewModel(null, day);

            try
            {
                target.PropertyChanged += new PropertyChangedEventHandler(OnPropertyChanged);

                PreparePropertyChangedTest();
                day.SetDate(date.AddDays(-1));
                Assert.IsTrue(NotifiedProperties.Contains("Month"), "PropertyChanged event wasn't raised on property 'Month' changing to December.");
            }
            finally
            {
                target.PropertyChanged -= new PropertyChangedEventHandler(OnPropertyChanged);
            }
        }
Exemplo n.º 5
0
        private void InitDayCells(List<SchedulerBaseElementViewModel> elementList)
        {
            int row = 1;
            foreach (SchedulerWeekModel week in month.Weeks)
            {
                int col = 1;
                foreach (SchedulerDayModel day in week.Days)
                {
                    SchedulerMonthDayHeaderViewModel header = new SchedulerMonthDayHeaderViewModel(scheduler, day);
                    header.Column = col;
                    header.Row = row;
                    elementList.Add(header);

                    SchedulerMonthDayBodyViewModel body = new SchedulerMonthDayBodyViewModel(day);
                    body.Column = col;
                    body.Row = row + 1;
                    elementList.Add(body);

                    col += 1;
                }
                row += 2;
            }
        }