public void UseItemCommandWithEmptyBag() { Game game = new Game(5, 2, 20); Dungeon d = new Dungeon(1, 1); game.dungeon = d; game.player.location = d.startNode; UseItemCommand cmd = new UseItemCommand(); Assert.Throws <ArgumentException>(() => cmd.Execute(game.player, game.dungeon)); }
public void UseItemCommand() { Dungeon d = new Dungeon(1, 1); Game game = new Game(5, 2, 20); game.player.location = d.startNode; game.player.dungeon = d; game.player.bag.Add(new HealingPotion("p1")); game.player.bag.Add(new HealingPotion("p2")); UseItemCommand cmd = new UseItemCommand(); cmd.Execute(game.player, game.dungeon); Assert.AreEqual(1, game.player.bag.Count); cmd = new UseItemCommand(); cmd.Execute(game.player, game.dungeon); Assert.AreEqual(0, game.player.bag.Count); }