public void TestSetGetItem() { NativeListControl list = new NativeListControl(testDlg.IdentifyFromDialogId(1037)); LVITEM setData = new LVITEM(); LVITEM getData = new LVITEM(); foreach (LVIF element in (LVIF[])Enum.GetValues(typeof(LVIF))) { setData.mask |= element; getData.mask |= element; } foreach (LVIS element in (LVIS[])Enum.GetValues(typeof(LVIS))) { setData.stateMask |= element; getData.stateMask |= element; } //アイテムの変更 setData.iItem = 2; setData.iSubItem = 0; setData.state = LVIS.CUT; setData.pszText = "abc"; setData.iImage = 2; setData.lParam = new IntPtr(3); list.EmulateChangeItem(setData); //変更結果の確認 getData.iItem = 2; getData.iSubItem = 0; list.GetItem(getData); Assert.AreEqual(setData.iItem, getData.iItem); Assert.AreEqual(setData.iSubItem, getData.iSubItem); Assert.AreEqual(setData.state, getData.state); Assert.AreEqual(setData.pszText, getData.pszText); Assert.AreEqual(setData.iImage, getData.iImage); Assert.AreEqual(setData.lParam, getData.lParam); //非同期でも同様の効果があることを確認。 Async a = new Async(); setData.pszText = "efg"; list.EmulateChangeItem(setData, a); while (!a.IsCompleted) { Thread.Sleep(10); } list.GetItem(getData); Assert.AreEqual(setData.pszText, getData.pszText); }