コード例 #1
0
        public void GetPlayerByNameMethodTest()
        {
            var playerList = MockBuilder.GetPlayerList();

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

            Assert.AreSame(GameBoard.GetBoard().GetPlayerByName("TestName1"), testPlayer);
        }
コード例 #2
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);
        }
コード例 #3
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);
        }
コード例 #4
0
ファイル: GameEngineTests.cs プロジェクト: AlexRoyden/Risk
        public void TestGetPlayerColourIndexMethodReturnsInt()
        {
            var players = MockBuilder.GetPlayerList();

            players[2].Colour = 2;
            var board = GameBoard.GetBoard();

            board.SetPlayerList(players);

            Assert.IsTrue(GameEngine.GetPlayerColourIndex("TestName3") == 2);
        }
コード例 #5
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);
        }