public void ModelFacade_DiscardItem() { PCModel pcm = gs.GetPCM(); PlayerCharacter workingPC = pcm.GetPC(); Inventory workingInv = pcm.GetInventory(); Assert.IsTrue(workingInv.Contains(items[0]), "Inventory should contain Item 1"); Assert.IsTrue(workingInv.Contains(items[2]), "Inventory should contain Item 3"); Assert.IsTrue(workingInv.Contains(items[3]), "Inventory should contain Item 4"); Assert.IsTrue(workingInv.Contains(items[5]), "Inventory should contain Item 6"); Assert.IsTrue(workingInv.Contains(items[7]), "Inventory should contain Item 8"); Assert.IsTrue(workingInv.Contains(items[21]), "Inventory should contain Item 22"); Assert.IsTrue(workingInv.Contains(items[23]), "Inventory should contain Item 24"); int invSlot = workingInv.GetInventorySlot(items[2]); Assert.IsTrue(mf.DiscardItem(gs, invSlot), "Should be possible to discard Item 3"); Assert.IsFalse(workingInv.Contains(items[2]), "Inventory should not contain Item 3"); invSlot = workingInv.GetInventorySlot(items[7]); Assert.IsTrue(workingInv.Contains(items[7]), "Inventory should contain Item 8"); Assert.IsTrue(mf.DiscardItem(gs, invSlot), "Should be possible to discard Item 8"); Assert.IsFalse(workingInv.Contains(items[7]), "Inventory should not contain Item 8"); Assert.IsFalse(mf.DiscardItem(gs, 10), "Should not be possible to discard empty slot"); }
/// <summary> /// Attempts to discard the item /// </summary> /// <param name="inventorySlot">The inventory slot to discard items from</param> /// <returns>If it was sucessfully discarded</returns> public bool DiscardItem(int inventorySlot) { return(mf.DiscardItem(gs, inventorySlot)); }