public void TestEmulateSelectItemEvent()
 {
     NativeTree tree = new NativeTree(testDlg.IdentifyFromDialogId(1041));
     tree.EmulateSelectItem(tree.Nodes[0]);
     Assert.IsTrue(EventChecker.IsSameTestEvent(testDlg,
         delegate { tree.EmulateSelectItem(tree.Nodes[1]); },
         //無視
         new CodeInfo[] {
             new CodeInfo(1041, NativeMethods.WM_NOTIFY, TVN_ITEMCHANGING),
             new CodeInfo(1041, NativeMethods.WM_NOTIFY, TVN_ITEMCHANGED),
         },
         //確認
         new CodeInfo[] { 
             new CodeInfo(1041, NativeMethods.WM_NOTIFY, TVN_SELCHANGING),
             new CodeInfo(1041, NativeMethods.WM_NOTIFY, TVN_SELCHANGED)
         }
     ));
 }
 public void TestEmulateSelectItemEventAsync()
 {
     NativeTree tree = new NativeTree(testDlg.IdentifyFromDialogId(1042));
     Async async = new Async();
     tree.EmulateSelectItem(tree.FindNode(0, 0), async);
     Assert.IsTrue(0 < MessageBoxUtility.CloseAll(testDlg, async));
 }
        public void TestSelectedItem()
        {
            NativeTree tree = new NativeTree(testDlg.IdentifyFromDialogId(1041));
            tree.EmulateSelectItem(tree.FindNode(0, 1));
            Assert.AreEqual("2", tree.GetItemText(tree.SelectedItem));

            //非同期でも同様の効果があることの確認。
            Async a = new Async();
            tree.EmulateSelectItem(tree.FindNode(1, 0), a);
            while (!a.IsCompleted)
            {
                Thread.Sleep(10);
            }
            Assert.AreEqual("0", tree.GetItemText(tree.SelectedItem));
        }