public void ProcessCommandEatsEdibleObjectWithMultipleStatsToUpdate() { IGame game = new Game(); var room = new Room("name1", "description1", game); game.CurrentRoom = room; game.StartRoom = room; List <PlayerStatsAdjustments> stats = new List <PlayerStatsAdjustments>(); PlayerStatsAdjustments health = new PlayerStatsAdjustments("health", 10); PlayerStatsAdjustments skill = new PlayerStatsAdjustments("skill", 5); stats.Add(health); stats.Add(skill); IObject _chicken = new GameObject("Chicken", "It is the remains of a cooked chicken.", "You pick up the chicken.", true, stats, "You eat the chicken; it was lovely."); game.Player.Inventory.Add(_chicken.Name, _chicken); ICommand command = new Command { Verb = VerbCodes.Eat, Noun = "chicken" }; var reply = room.ProcessCommand(command); Assert.AreEqual("You eat the chicken; it was lovely.\r\nPlayer HEALTH increased by 10 points to : 10\r\nPlayer SKILL increased by 5 points to : 5", reply); }
public void ProcessCommandEatsEdibleFailsIfNotInTheInventoryWithMultipleStatsToUpdate() { IGame game = new Game(); var room = new Room("name1", "description1", game); game.CurrentRoom = room; game.StartRoom = room; List <PlayerStatsAdjustments> stats = new List <PlayerStatsAdjustments>(); PlayerStatsAdjustments health = new PlayerStatsAdjustments("health", 10); PlayerStatsAdjustments skill = new PlayerStatsAdjustments("skill", 5); stats.Add(health); stats.Add(skill); IObject _chicken = new GameObject("Chicken", "It is the remains of a cooked chicken.", "You pick up the chicken.", true, stats, "You eat the chicken; it was lovely."); ICommand command = new Command { Verb = VerbCodes.Eat, Noun = "chicken" }; Assert.IsFalse(game.Player.Inventory.Exists("Chicken")); var reply = room.ProcessCommand(command); Assert.AreEqual("I'm not hungry.", reply); Assert.IsFalse(game.Player.Inventory.Exists("Chicken")); }
public void SecondConstructorSetsEatenFlagTest() { List <PlayerStatsAdjustments> stats = new List <PlayerStatsAdjustments>(); PlayerStatsAdjustments health = new PlayerStatsAdjustments("health", 10); PlayerStatsAdjustments skill = new PlayerStatsAdjustments("skill", 5); stats.Add(health); stats.Add(skill); IObject gameObject = new GameObject("objectName", "object description", "pickup message", true, stats, "you have eaten the cheese"); Assert.IsTrue(gameObject.Edible); }
public void SecondExtendedConstructorStatsToApplyTest() { List <PlayerStatsAdjustments> stats = new List <PlayerStatsAdjustments>(); PlayerStatsAdjustments health = new PlayerStatsAdjustments("health", 10); PlayerStatsAdjustments skill = new PlayerStatsAdjustments("skill", 5); stats.Add(health); stats.Add(skill); IObject gameObject = new GameObject("objectName", "object description", "pickup message", true, stats, "you have eaten the cheese"); Assert.AreEqual(10, gameObject.StatsAdjustment[0].PointsToApply); Assert.AreEqual("health", gameObject.StatsAdjustment[0].StatToModify); Assert.AreEqual(5, gameObject.StatsAdjustment[1].PointsToApply); Assert.AreEqual("skill", gameObject.StatsAdjustment[1].StatToModify); }
public void ConstructorSetsPointsToApply() { PlayerStatsAdjustments stats = new PlayerStatsAdjustments("health", 100); Assert.AreEqual(100, stats.PointsToApply); }
public void ConstructorSetsStatToModify() { PlayerStatsAdjustments stats = new PlayerStatsAdjustments("health", 100); Assert.AreEqual("health", stats.StatToModify); }