コード例 #1
0
ファイル: GameEngineTests.cs プロジェクト: AlexRoyden/Risk
        public void TestHighestRollreturnsAWinner()
        {
            var players = MockBuilder.GetPlayerList();
            var winner  = GameEngine.HighestRoll(players);

            Assert.IsTrue(winner == players[0] || winner == players[1] || winner == players[2] ||
                          winner == players[3] || winner == players[4] || winner == players[5]);
        }
コード例 #2
0
ファイル: GameEngineTests.cs プロジェクト: AlexRoyden/Risk
        public void TestGetPlayerIndexMethodReturnsIndex()
        {
            var players = MockBuilder.GetPlayerList();
            var board   = GameBoard.GetBoard();

            board.SetPlayerList(players);

            Assert.IsTrue(GameEngine.GetPlayerIndex("TestName3") == 2);
        }
コード例 #3
0
        public void GetPlayerByNameMethodTest()
        {
            var playerList = MockBuilder.GetPlayerList();

            GameBoard.GetBoard().SetPlayerList(playerList);
            var testPlayer = playerList[0];

            Assert.AreSame(GameBoard.GetBoard().GetPlayerByName("TestName1"), testPlayer);
        }
コード例 #4
0
        public void GetPlayerByIndexMethodTest()
        {
            GameBoard.GetBoard().SetPlayerList(MockBuilder.GetPlayerList());
            var rnd      = GameBoard.GetBoard().GetRandom();
            var index    = rnd.Next(0, 5);
            var testList = MockBuilder.GetPlayerList();

            Assert.IsTrue(GameBoard.GetBoard().GetPlayerByIndex(index).Name == testList[index].Name);
        }
コード例 #5
0
        public void SetPlayerTurnQueueMethodTest()
        {
            GameBoard.GetBoard().SetPlayerTurnQueue(MockBuilder.GetPlayerQueue());
            var rnd       = GameBoard.GetBoard().GetRandom();
            var index     = rnd.Next(0, 5);
            var queue     = GameBoard.GetBoard().GetPlayerList();
            var testQueue = MockBuilder.GetPlayerList();

            Assert.IsTrue(queue[index].Name == testQueue[index].Name);
        }
コード例 #6
0
ファイル: GameEngineTests.cs プロジェクト: AlexRoyden/Risk
        public void TestCreateTurnQueueIsCorrectOrder()
        {
            var players = MockBuilder.GetPlayerList();

            GameBoard.GetBoard().SetPlayerList(players);
            var rnd    = GameBoard.GetBoard().GetRandom();
            var player = GameBoard.GetBoard().GetPlayerByIndex(rnd.Next(0, 5));

            var queue = GameEngine.CreateTurnQueue(player);

            Assert.IsTrue(queue.Dequeue().Name == player.Name);
        }