public void ListViewGroupCollection_Insert_InvalidIndex_ThrowsArgumentOutOfRangeException(int index) { using var listView = new ListView(); ListViewGroupCollection collection = listView.Groups; Assert.Throws <ArgumentOutOfRangeException>("index", () => collection.Insert(index, new ListViewGroup())); }
public void ListViewGroupCollection_Insert_NullGroup_ThrowsArgumentNullException(int index) { using var listView = new ListView(); ListViewGroupCollection collection = listView.Groups; collection.Add(new ListViewGroup()); Assert.Throws <ArgumentNullException>("group", () => collection.Insert(index, null)); }
public void ListViewGroupCollection_Insert_ListViewGroup_Success() { using var listView = new ListView(); ListViewGroupCollection collection = listView.Groups; var group = new ListViewGroup(); collection.Add(new ListViewGroup()); collection.Insert(1, group); Assert.Equal(2, collection.Count); Assert.Same(group, collection[1]); Assert.Same(listView, group.ListView); }
public void ListViewGroupCollection_Insert_SetAlreadyInCollection_Nop(int index) { using var listView = new ListView(); ListViewGroupCollection collection = listView.Groups; var group1 = new ListViewGroup(); var group2 = new ListViewGroup(); collection.Add(group1); collection.Add(group2); collection.Insert(index, group2); Assert.Same(group1, collection[0]); }
public void ListViewGroupCollection_Insert_ListViewGroupWithHandle_Success() { var listView = new ListView(); Assert.NotEqual(IntPtr.Zero, listView.Handle); ListViewGroupCollection collection = listView.Groups; var group = new ListViewGroup(); collection.Add(new ListViewGroup()); collection.Insert(1, group); Assert.Equal(2, collection.Count); Assert.Same(group, collection[1]); Assert.Same(listView, group.ListView); }
public void ListViewGroupCollection_Insert_HasItemsFromOtherListView_ThrowsArgumentException() { var listView = new ListView(); ListViewGroupCollection collection = listView.Groups; var otherListView = new ListView(); var item = new ListViewItem(); var group = new ListViewGroup(); group.Items.Add(item); otherListView.Items.Add(item); Assert.Throws <ArgumentException>(null, () => collection.Insert(0, group)); Assert.Empty(collection); }
public void ListViewGroupCollection_Insert_ListViewGroupWithItems_Success() { using var listView = new ListView(); var item = new ListViewItem(); ListViewGroupCollection collection = listView.Groups; var group = new ListViewGroup(); group.Items.Add(new ListViewItem()); group.Items.Add(item); listView.Items.Add(item); collection.Insert(0, group); Assert.Same(group, Assert.Single(collection)); Assert.Same(listView, group.ListView); }
public void ListViewGroupCollection_Insert_SetHasItemsFromOtherListView_Success() { var listView = new ListView(); ListViewGroupCollection collection = listView.Groups; collection.Add(new ListViewGroup()); var otherListView = new ListView(); var item = new ListViewItem(); var group = new ListViewGroup(); group.Items.Add(item); otherListView.Items.Add(item); collection.Insert(0, group); Assert.Same(group, collection[0]); Assert.Same(listView, group.ListView); }
public void ListViewGroupCollection_Insert_ListViewGroupWithItemsWithHandle_Success() { var listView = new ListView(); Assert.NotEqual(IntPtr.Zero, listView.Handle); var item = new ListViewItem(); ListViewGroupCollection collection = listView.Groups; var group = new ListViewGroup(); group.Items.Add(new ListViewItem()); group.Items.Add(item); listView.Items.Add(item); collection.Insert(0, group); Assert.Same(group, Assert.Single(collection)); Assert.Same(listView, group.ListView); }
public void ListViewGroupCollection_Insert_AlreadyInOtherCollection_GetReturnsExpected() { using var listView = new ListView(); ListViewGroupCollection collection = listView.Groups; collection.Add(new ListViewGroup()); using var otherListView = new ListView(); ListViewGroupCollection otherCollection = otherListView.Groups; var group = new ListViewGroup(); otherCollection.Add(group); // The group appears to belong to two list views. collection.Insert(0, group); Assert.Same(group, collection[0]); Assert.Same(listView, group.ListView); Assert.Equal(group, collection[0]); Assert.Equal(group, Assert.Single(otherCollection)); }