public void Day22_Part1_Examples3() { var p1 = new Day22.Player("Player", 10, 250); var p2 = new Day22.Boss("Boss", 14, 8); var game = new Day22.Game(p1, p2, false); var spells = new List <Day22.Spell>(); spells.Add(Day22.Spell.GetByName("Recharge")); spells.Add(Day22.Spell.GetByName("Shield")); spells.Add(Day22.Spell.GetByName("Drain")); spells.Add(Day22.Spell.GetByName("Poison")); spells.Add(Day22.Spell.GetByName("Magic Missle")); foreach (var spell in spells) { Assert.IsFalse(game.Winner.HasValue); game.TakeTurn(spell); } var expected = Day22.Players.Player; var actual = game.Winner; Assert.AreEqual(expected, actual); }
public void Y2015_Day22_Fight_Win_Scenario_2() { // Arrange IList <string> spellsToConjure = new[] { "Recharge", "Shield", "Drain", "Poison", "MagicMissile" }; int index = 0; string SpellSelector(Day22.Wizard w, ICollection <string> s) => spellsToConjure[index++]; var wizard = new Day22.Wizard(10, 250, SpellSelector); var opponent = new Day22.Boss(14, 8); string difficulty = "easy"; // Act Day22.Player actual = Day22.Fight(wizard, opponent, difficulty, Output); // Assert actual.ShouldNotBeNull(); actual.ShouldBeSameAs(wizard); opponent.Armor.ShouldBe(0); opponent.Damage.ShouldBe(8); opponent.HitPoints.ShouldBe(-1); wizard.Damage.ShouldBe(0); wizard.HitPoints.ShouldBe(1); wizard.Mana.ShouldBe(114); wizard.ActiveSpells.ShouldBe(new[] { "Poison" }); wizard.ManaSpent.ShouldBe(229 + 113 + 73 + 173 + 53); wizard.SpellsCast.ShouldBe(spellsToConjure); }
public void Day22_Part1_Examples() { var p1 = new Day22.Player("Player", 10, 250); var p2 = new Day22.Boss("Boss", 13, 8); var game = new Day22.Game(p1, p2, false); var spells = new List <Day22.Spell>(); spells.Add(Day22.Spell.GetByName("Poison")); spells.Add(Day22.Spell.GetByName("Magic Missle")); var expected = Day22.Players.Player; game.Simulate(spells); var actual = game.Winner; Assert.AreEqual(expected, actual); }