public void TestEmulateChangeSelectEvent()
 {
     //LBN_SELCHANGEが発生していることを確認。
     NativeListBox listBox = new NativeListBox(testDlg.IdentifyFromDialogId(1035));
     listBox.EmulateChangeSelect(0, false);
     Assert.IsTrue(EventChecker.IsSameTestEvent(testDlg,
         delegate { listBox.EmulateChangeSelect(0, true); },
         new CodeInfo(1035, NativeMethods.WM_COMMAND, LBN_SELCHANGE)));
 }
 public void TestEmulateChangeSelectEventAsync()
 {
     NativeListBox listBox = new NativeListBox(testDlg.IdentifyFromDialogId(1036));
     Async async = new Async();
     listBox.EmulateChangeSelect(1, true, async);
     Assert.IsTrue(0 < MessageBoxUtility.CloseAll(testDlg, async));
 }
        public void TestSelectedIndices()
        {
            NativeListBox listBox = new NativeListBox(testDlg.IdentifyFromDialogId(1035));
            listBox.EmulateChangeSelect(0, true);
            listBox.EmulateChangeSelect(1, false);
            listBox.EmulateChangeSelect(2, true);
            AssertEx.AreEqual(new int[] { 0, 2 }, listBox.SelectedIndices);

            //非同期でも正常に動作することを確認。
            Async a = new Async();
            listBox.EmulateChangeSelect(2, false, a);
            while (!a.IsCompleted)
            {
                Thread.Sleep(10);
            }
            AssertEx.AreEqual(new int[] { 0 }, listBox.SelectedIndices);
        }