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));
        }
        /// <summary>
        /// 現在の選択日付を設定します。
        /// MCN_SELCHANGE、MCN_SELECTの通知が発生します。
        /// </summary>
        /// <param name="handle">ウィンドウハンドル。</param>
        /// <param name="min">最小日付。</param>
        /// <param name="max">最大日付。</param>
        private static void EmulateSelectDayInTarget(IntPtr handle, DateTime min, DateTime max)
        {
            NativeMethods.SetFocus(handle);

            SYSTEMTIME[] sysTimes = new SYSTEMTIME[] { NativeDataUtility.ToSYSTEMTIME(min), NativeDataUtility.ToSYSTEMTIME(max) };
            NativeMethods.SendMessage(handle, MCM_SETSELRANGE, IntPtr.Zero, sysTimes);

            //通知
            foreach (int message in new int[] { MCN_SELCHANGE, MCN_SELECT })
            {
                NMSELCHANGE notify = new NMSELCHANGE();
                EmulateUtility.InitNotify(handle, message, ref notify.nmhdr);
                notify.stSelStart = sysTimes[0];
                notify.stSelEnd = sysTimes[1];
                NativeMethods.SendMessage(NativeMethods.GetParent(handle), NativeCommonDefine.WM_NOTIFY, notify.nmhdr.idFrom, ref notify);
            }
        }
        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));
        }
        /// <summary>
        /// 現在の選択日付を設定します。
        /// MCN_SELCHANGE、MCN_SELECTの通知が発生します。
        /// </summary>
        /// <param name="handle">ウィンドウハンドル。</param>
        /// <param name="day">選択する日時。</param>
        private static void EmulateSelectDayInTarget(IntPtr handle, DateTime day)
        {
            NativeMethods.SetFocus(handle);

            //変更
            SYSTEMTIME native = NativeDataUtility.ToSYSTEMTIME(day);
            NativeMethods.SendMessage(handle, MCM_SETCURSEL, IntPtr.Zero, ref native);

            //通知
            foreach (int message in new int[] { MCN_SELCHANGE, MCN_SELECT })
            {
                NMSELCHANGE notify = new NMSELCHANGE();
                EmulateUtility.InitNotify(handle, message, ref notify.nmhdr);
                notify.stSelStart = notify.stSelEnd = native;
                NativeMethods.SendMessage(NativeMethods.GetParent(handle), NativeCommonDefine.WM_NOTIFY, notify.nmhdr.idFrom, ref notify);
            }
        }