public void TestSelectedDay() { DateTime setDay = DateTime.Today.AddDays(1); NativeDateTimePicker picker = new NativeDateTimePicker(testDlg.IdentifyFromDialogId(1013)); picker.EmulateSelectDay(setDay); Assert.AreEqual(setDay, picker.SelectedDay.Date); //非同期でも同様の効果があることを確認。 setDay = setDay.AddDays(1); Async a = new Async(); picker.EmulateSelectDay(setDay, a); while (!a.IsCompleted) { Thread.Sleep(10); } Assert.AreEqual(setDay, picker.SelectedDay.Date); }
public void TestConstructor() { DateTime setDay = DateTime.Today.AddDays(1); //WindowControlから作成。 { NativeDateTimePicker picker = new NativeDateTimePicker(testDlg.IdentifyFromDialogId(1013)); picker.EmulateSelectDay(setDay); Assert.AreEqual(setDay, picker.SelectedDay.Date); } //ハンドルから作成。 { NativeDateTimePicker picker = new NativeDateTimePicker(app, testDlg.IdentifyFromDialogId(1013).Handle); picker.EmulateSelectDay(setDay); Assert.AreEqual(setDay, picker.SelectedDay.Date); } }
public void TestEmulateSelectDayEventAsync() { NativeDateTimePicker picker = new NativeDateTimePicker(testDlg.IdentifyFromDialogId(1014)); Async async = new Async(); picker.EmulateSelectDay(DateTime.Today.AddDays(1), async); Assert.IsTrue(0 < MessageBoxUtility.CloseAll(testDlg, async)); }
public void TestEmulateSelectDayEvent() { //イベント確認。 NativeDateTimePicker picker = new NativeDateTimePicker(testDlg.IdentifyFromDialogId(1013)); picker.EmulateSelectDay(DateTime.Today); DateTime setDay = DateTime.Today.AddDays(1); Assert.IsTrue(EventChecker.IsSameTestEvent(testDlg, delegate { picker.EmulateSelectDay(setDay); }, new CodeInfo(1013, NativeMethods.WM_NOTIFY, DTN_DATETIMECHANGE))); //詳細な通知内容をテスト。 setDay = setDay.AddDays(1); NMDATETIMECHANGE[] expectation = new NMDATETIMECHANGE[1]; expectation[0].dwFlags = 0; expectation[0].st = NativeDataUtility.ToSYSTEMTIME(setDay); Assert.IsTrue(EventChecker.CheckNotifyDetail(testDlg, delegate { picker.EmulateSelectDay(setDay); }, expectation)); }