Exemplo n.º 1
0
 /// <summary>
 /// Creates a new game instance.
 /// </summary>
 public GameManager()
 {
     _gameSettings = new GameSettings();
     _gameState = GameStates.NotStarted;
     _playerTurnState = PlayerTurnState.None;
     _gameBoard = new GameBoard();
     _players = new List<Player>();
     _developmentCardDeck = new CardDeck<DevelopmentCards>();
     _dice = new Dice();
     _tradeHelper = new TradeHelper();
     _playersCardsToLose = new Dictionary<Player, int>();
     _playersToStealFrom = new List<Player>();
 }
Exemplo n.º 2
0
        public void TestRoll()
        {
            var dice = new Dice();

            int low = int.MaxValue;
            int high = int.MinValue;
            for (int i = 0; i < 10000; i++)
            {
                int roll = dice.Roll();
                if (roll < low)
                    low = roll;
                if (roll > high)
                    high = roll;
            }

            Assert.AreEqual(2, low, "The lowest roll should be a 2.");
            Assert.AreEqual(12, high, "The highest roll should be a 12.");
        }
Exemplo n.º 3
0
        public void TestLog()
        {
            var dice = new Dice();
            int rollCount = 100;
            var log = new int[rollCount];

            for (int i = 0; i < rollCount; i++)
            {
                int roll = dice.Roll();
                log[i] = roll;
            }

            Assert.AreEqual(rollCount, dice.RollLog.Count, "The log is not the correct size.");
            for (int i = 0; i < rollCount; i++)
            {
                Assert.AreEqual(log[i], dice.RollLog[i], "The values in the log should be the same.");
            }
        }