public void TestMultiSelectEventAsync()
 {
     DateTime min = DateTime.Today.AddDays(1);
     DateTime max = DateTime.Today.AddDays(2);
     NativeMonthCalendar calendar = new NativeMonthCalendar(testDlg.IdentifyFromDialogId(1034));
     Async async = new Async();
     calendar.EmulateSelectDay(min, max, async);
     Assert.IsTrue(0 < MessageBoxUtility.CloseAll(testDlg, async));
 }
        public void TestMultiSelectEvent()
        {
            //イベント確認。
            NativeMonthCalendar calendar = new NativeMonthCalendar(testDlg.IdentifyFromDialogId(1031));
            calendar.EmulateSelectDay(DateTime.Today);
            DateTime min = DateTime.Today.AddDays(1);
            DateTime max = DateTime.Today.AddDays(2);
            Assert.IsTrue(EventChecker.IsSameTestEvent(testDlg,
                delegate { calendar.EmulateSelectDay(min, max); },
                new CodeInfo(1031, NativeMethods.WM_NOTIFY, MCN_SELCHANGE),
                new CodeInfo(1031, NativeMethods.WM_NOTIFY, MCN_SELECT)));

            //詳細な通知内容の確認。
            min = min.AddDays(1);
            max = max.AddDays(1);
            NMSELCHANGE[] expectation = new NMSELCHANGE[2];
            expectation[0].stSelStart = expectation[1].stSelStart = NativeDataUtility.ToSYSTEMTIME(min);
            expectation[0].stSelEnd = expectation[1].stSelEnd = NativeDataUtility.ToSYSTEMTIME(max);
            Assert.IsTrue(EventChecker.CheckNotifyDetail(testDlg,
                 delegate { calendar.EmulateSelectDay(min, max); },
                expectation));
        }
        public void TestMultiSelectValue()
        {
            NativeMonthCalendar calendar = new NativeMonthCalendar(testDlg.IdentifyFromDialogId(1031));
            DateTime min = DateTime.Today.AddDays(1);
            DateTime max = DateTime.Today.AddDays(2);
            calendar.EmulateSelectDay(min, max);

            DateTime minRet = new DateTime(), maxRet = new DateTime();
            calendar.GetSelectionRange(ref minRet, ref maxRet);
            Assert.AreEqual(min, minRet.Date);
            Assert.AreEqual(max, maxRet.Date);

            //非同期でも同様の効果があることを確認。
            min = min.AddDays(1);
            max = max.AddDays(1);
            Async a = new Async();
            calendar.EmulateSelectDay(min, max, a);
            while (!a.IsCompleted)
            {
                Thread.Sleep(10);
            }
            calendar.GetSelectionRange(ref minRet, ref maxRet);
            Assert.AreEqual(min, minRet.Date);
            Assert.AreEqual(max, maxRet.Date);
        }
 public void TestSingleSelectEventAsync()
 {
     NativeMonthCalendar calendar = new NativeMonthCalendar(testDlg.IdentifyFromDialogId(1032));
     Async async = new Async();
     calendar.EmulateSelectDay(DateTime.Today.AddDays(1), async);
     Assert.IsTrue(0 < MessageBoxUtility.CloseAll(testDlg, async));
 }
        public void TestSingleSelectEvent()
        {
            NativeMonthCalendar calendar = new NativeMonthCalendar(testDlg.IdentifyFromDialogId(1033));
            calendar.EmulateSelectDay(DateTime.Today);
            DateTime setDay = DateTime.Today.AddDays(1);
            Assert.IsTrue(EventChecker.IsSameTestEvent(testDlg,
                delegate { calendar.EmulateSelectDay(setDay); },
                new CodeInfo(1033, NativeMethods.WM_NOTIFY, MCN_SELCHANGE),
                new CodeInfo(1033, NativeMethods.WM_NOTIFY, MCN_SELECT)));

            //詳細な通知内容の確認。
            setDay.AddDays(1);
            NMSELCHANGE[] expectation = new NMSELCHANGE[2];
            expectation[0].stSelStart = expectation[1].stSelStart =
            expectation[0].stSelEnd = expectation[1].stSelEnd = NativeDataUtility.ToSYSTEMTIME(setDay);
            Assert.IsTrue(EventChecker.CheckNotifyDetail(testDlg,
                delegate { calendar.EmulateSelectDay(setDay); },
                expectation));
        }
        public void TestSingleSelectValue()
        {
            NativeMonthCalendar calendar = new NativeMonthCalendar(testDlg.IdentifyFromDialogId(1033));
            DateTime setDay = DateTime.Today.AddDays(1);
            calendar.EmulateSelectDay(setDay);
            Assert.AreEqual(setDay, calendar.SelectedDay.Date);

            //非同期でも同様の効果があることを確認。
            Async a = new Async();
            setDay = DateTime.Today.AddDays(1);
            calendar.EmulateSelectDay(setDay, a);
            while (!a.IsCompleted)
            {
                Thread.Sleep(10);
            }
            Assert.AreEqual(setDay, calendar.SelectedDay.Date);
        }