public void TestEmulateChangeStateEvent()
 {
     NativeListControl list = new NativeListControl(testDlg.IdentifyFromDialogId(1037));
     Assert.IsTrue(EventChecker.IsSameTestEvent(testDlg,
         delegate { list.EmulateChangeItemState(2, LVIS.FOCUSED, LVIS.FOCUSED); },
         new CodeInfo(1037, NativeMethods.WM_NOTIFY, LVN_ITEMCHANGING),
         new CodeInfo(1037, NativeMethods.WM_NOTIFY, LVN_ITEMCHANGED)
     ));
 }
 public void TestEmulateChangeStateAsync()
 {
     NativeListControl list = new NativeListControl(testDlg.IdentifyFromDialogId(1038));
     Async async = new Async();
     list.EmulateChangeItemState(2, LVIS.FOCUSED, LVIS.FOCUSED, async);
     Assert.IsTrue(0 < MessageBoxUtility.CloseAll(testDlg, async));
 }
        public void TestState()
        {
            NativeListControl list = new NativeListControl(testDlg.IdentifyFromDialogId(1037));
            list.EmulateChangeItemState(3, LVIS.FOCUSED, LVIS.FOCUSED);
            Assert.AreEqual(list.GetItemState(3, LVIS.FOCUSED), LVIS.FOCUSED);

            //非同期でも同様の効果があることを確認。
            Async a = new Async();
            list.EmulateChangeItemState(5, LVIS.FOCUSED, LVIS.FOCUSED, a);
            a.WaitForCompletion();
            Assert.AreEqual(list.GetItemState(5, LVIS.FOCUSED), LVIS.FOCUSED);
        }