public void AddMethodsAppendsToEmptyCollection() { ToolStrip strip = new ToolStrip(); ToolStripItemCollectionUIAdapter adapter = new ToolStripItemCollectionUIAdapter(strip.Items); ToolStripButton button = new ToolStripButton(); adapter.Add(button); Assert.AreSame(button, strip.Items[0]); }
public void AddAppendsToCollectionWithItems() { ToolStrip strip = new ToolStrip(); ToolStripButton button1 = new ToolStripButton(); strip.Items.Add(button1); ToolStripItemCollectionUIAdapter adapter = new ToolStripItemCollectionUIAdapter(strip.Items); ToolStripButton button2 = new ToolStripButton(); adapter.Add(button2); Assert.AreEqual(2, strip.Items.Count); Assert.AreSame(button1, strip.Items[0]); Assert.AreSame(button2, strip.Items[1]); }
public void CanRemoveAnItem() { ToolStrip strip = new ToolStrip(); ToolStripButton button1 = new ToolStripButton(); strip.Items.Add(button1); ToolStripItemCollectionUIAdapter adapter = new ToolStripItemCollectionUIAdapter(strip.Items); ToolStripButton button2 = new ToolStripButton(); adapter.Add(button2); adapter.Remove(button1); Assert.AreEqual(1, strip.Items.Count); Assert.AreSame(button2, strip.Items[0]); }