public void DisplayedWeeksCaptionTest()
        {
            SchedulerViewModel scheduler = new SchedulerViewModel(null, new CultureInfo("en-US"), false, false);
            SchedulerMonthViewModel target = new SchedulerMonthViewModel(scheduler, null);
            DateTime date = new DateTime(2010, 1, 1);
            target.Initialize(new DateTime(2010, 2, 1));

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

                PreparePropertyChangedTest();
                target.SetView(date);
                Assert.AreEqual(5, target.DisplayedWeeks, "DisplayedWeeks must be set 5.");
                Assert.IsTrue(NotifiedProperties.Contains("DisplayedWeeks"), "PropertyChanged event wasn't raised on property 'DisplayedWeeks' changing to 5.");

                PreparePropertyChangedTest();
                target.SetView(date.AddDays(40));
                Assert.AreEqual(4, target.DisplayedWeeks, "DisplayedWeeks must be set 4.");
                Assert.IsTrue(NotifiedProperties.Contains("DisplayedWeeks"), "PropertyChanged event wasn't raised on property 'DisplayedWeeks' changing to 4.");
            }
            finally
            {
                target.PropertyChanged -= new PropertyChangedEventHandler(OnPropertyChanged);
            }
        }
        public void CreateElementsTest()
        {
            SchedulerViewModel scheduler = new SchedulerViewModel(null, new CultureInfo("en-US"), false, false);
            SchedulerMonthViewModel_Accessor target = new SchedulerMonthViewModel_Accessor(scheduler, null);

            Assert.IsNull(target.Elements, "HeaderElements should be null.");

            target.InitializeModel(new DateTime(2010, 1, 1));
            target.CreateElements();

            Assert.IsNotNull(target.Elements, "HeaderElements should be initialized.");
        }
        public void SetViewDateTest()
        {
            SchedulerViewModel scheduler = new SchedulerViewModel(null, new CultureInfo("en-US"), false, false);
            SchedulerMonthViewModel_Accessor target = new SchedulerMonthViewModel_Accessor(scheduler, null);
            DateTime date = new DateTime(2010, 1, 1);
            target.InitializeModel(date);

            Assert.AreEqual(new DateTime(2009, 12, 28), target.month.Weeks[0].Days[0].Date, "Date should be 12/28/2009.");

            target.SetViewDate(date.AddMonths(-1));

            Assert.AreEqual(new DateTime(2009, 11, 30), target.month.Weeks[0].Days[0].Date, "Date should be 11/30/2009.");
        }
        public void SetDisplayedDateCaptionTest()
        {
            SchedulerViewModel scheduler = new SchedulerViewModel(null, new CultureInfo("en-US"), false, false);
            SchedulerMonthViewModel_Accessor target = new SchedulerMonthViewModel_Accessor(scheduler, null);
            target.InitializeModel(new DateTime(2010, 1, 1));

            Assert.IsNull(scheduler.DisplayedDate, "DisplayedDate should be null.");

            target.SetDisplayedDateCaption();

            Assert.IsNotNull(scheduler.DisplayedDate, "DisplayedDate should be set.");
        }
        public void SetTodayTest()
        {
            SchedulerViewModel scheduler = new SchedulerViewModel(null, new CultureInfo("en-US"), false, false);
            SchedulerMonthViewModel_Accessor target = new SchedulerMonthViewModel_Accessor(scheduler, null);
            DateTime date = new DateTime(2010, 1, 1);
            target.InitializeModel(date);

            Assert.IsTrue(target.month.Weeks[0].Days[4].IsToday, "Today should be 1/1/2010.");

            target.SetViewDate(date.AddDays(-7));

            Assert.IsFalse(target.month.Weeks[0].Days[4].IsToday, "Today should be 1/1/2010.");
        }
        public void InitializeModelTest()
        {
            SchedulerViewModel scheduler = new SchedulerViewModel(null, new CultureInfo("en-US"), false, false);
            SchedulerMonthViewModel_Accessor target = new SchedulerMonthViewModel_Accessor(scheduler, null);
            DateTime date = new DateTime(2010, 1, 1);

            Assert.IsNull(target.month, "week should be null.");

            target.InitializeModel(date);

            Assert.IsNotNull(target.month, "day should be initialized.");
            Assert.AreEqual(new DateTime(2009, 12, 28), target.month.Weeks[0].Days[0].Date, "Date should be 12/28/2009.");
        }
예제 #7
0
 public void WeekCommandTest()
 {
     SchedulerViewModel target = new SchedulerViewModel(null, new CultureInfo("en-US"), false, false);
     Assert.IsInstanceOfType(target.WeekCommand, typeof(ICommand), "WeekCommand should return ICommand object.");
 }
예제 #8
0
        public void SetDisplayedDateTest()
        {
            SchedulerViewModel target = new SchedulerViewModel(null, new CultureInfo("en-US"), false, false);
            try
            {
                target.PropertyChanged += new PropertyChangedEventHandler(OnPropertyChanged);

                PreparePropertyChangedTest();
                target.SetDisplayedDate("TEST");
                Assert.IsTrue(NotifiedProperties.Contains("DisplayedDate"), "PropertyChanged event wasn't raised on property 'DisplayedDate' changing to TEST.");

                PreparePropertyChangedTest();
                target.SetDisplayedDate("TEST");
                Assert.IsTrue(NotifiedProperties.Count == 0, "PropertyChanged event was incorectly raised on property 'DisplayedDate' changing to TEST.");
            }
            finally
            {
                target.PropertyChanged -= new PropertyChangedEventHandler(OnPropertyChanged);
            }
        }
예제 #9
0
 public void DisplayInfoTest()
 {
     SchedulerViewModel target = new SchedulerViewModel(null, new CultureInfo("en-US"), false, false);
     Assert.IsNotNull(target.DisplayInfo, "DisplayInfo is null.");
 }
        public void SetViewDateTest()
        {
            SchedulerViewModel scheduler = new SchedulerViewModel(null, new CultureInfo("en-US"), false, false);
            SchedulerWeekViewModel_Accessor target = new SchedulerWeekViewModel_Accessor(scheduler, null, DisplayedDays.Week);
            DateTime date = new DateTime(2010, 1, 1);
            target.InitializeModel(date);

            Assert.AreEqual(new DateTime(2009, 12, 28), target.week.Days[0].Date, "Date should be 12/28/2009.");

            target.SetViewDate(date.AddDays(-7));

            Assert.AreEqual(new DateTime(2009, 12, 21), target.week.Days[0].Date, "Date should be 12/21/2009.");
        }