private void Remove_It(object sender, EventArgs e) { if (jeter.BackColor == Color.DarkRed) { Item i = ((Button)sender).Tag as Item; if (_inventory.RemoveItem(i) == 0) { int j = 0; int k = 0; panel1.Controls.Remove((Button)sender); foreach (Button button in panel1.Controls) { if (j > 4) { j = 0; k++; } button.Left = j * 75; button.Top = k * 50; j++; } } } }
public void Test_Inventory_RemoveItem() { Item itemtest = new Item("épée", 10, 120, "Epee standard", "arme"); itemtest.AddRequired("attaque physique", 7); itemtest.AddStats("attaque physique", 5); Invent invent = new Invent(null); invent.AddItem(itemtest, 2); Assert.AreEqual(true, invent.GetItem(itemtest)); Assert.AreEqual(1, invent.RemoveItem(itemtest)); }