public void TestDieSetRoll4Times() { DieSet dieSet = new DieSet(); dieSet.Roll(); dieSet.Roll(); dieSet.Roll(); dieSet.Roll(); }
public override void TakeTurn() { Turn turn = new Turn(); DieSet dieSet = new DieSet(); dieSet.Roll(); Strategy.reroll(dieSet, 1, ScoreSheet); dieSet.Roll(); Strategy.reroll(dieSet, 0, ScoreSheet); dieSet.Roll(); string cat = Strategy.chooseCategory(dieSet, ScoreSheet); int points = ScoreSheet.Score(cat, dieSet); Console.WriteLine(Name + " scoring in " + cat + " for " + points + " points."); }
public void TestRollAllDie() { DieSet dieSet = new DieSet(); dieSet.Roll(); foreach (Die die in dieSet.Dice) { Assert.IsTrue(die.Value > 0); } }
public void TestDieSetReset() { DieSet dieSet = new DieSet(); dieSet.Roll(); foreach (Die die in dieSet.Dice) { die.Freeze(); } Assert.AreEqual(1, dieSet.TimesRolled); dieSet.Reset(); Assert.AreEqual(0, dieSet.TimesRolled); foreach (Die die in dieSet.Dice) { Assert.IsFalse(die.IsFrozen); } }
public void CheckSerialization() { PlayerList playerList = new PlayerList(); Turn turn = new Turn(); DieSet dieSet = new DieSet(); HumanPlayer hp = new HumanPlayer("Test Player Name"); ComputerPlayer cp = new ComputerPlayer("Test Computer Player", new GreedyAIStrategy()); playerList.Players.Add(hp); playerList.Players.Add(cp); dieSet.Roll(); GameState gameState = new GameState(); gameState.Players = playerList; gameState.Turn = turn; XmlSerializer serializer = new XmlSerializer(typeof(GameState)); using (TextWriter writer = new StreamWriter(@"C:\GameStateTest.xml")) { serializer.Serialize(writer, gameState); } }