示例#1
0
        public void Test_CheckMove_ResultDownRight_AllRow()
        {
            CustomGame customGame = InitGame();

            // Position of cell
            int xOrigin = 0;
            int yOrigin = 0;

            Cell cellOrigin = (Cell)customGame.Board.Board[xOrigin, yOrigin];

            cellOrigin.CellType       = CellType.FishWithPenguin;
            cellOrigin.CurrentPenguin = new Penguin(new Player("Player1", PlayerType.Human));

            // Position of cell
            int xDestination = 3;
            int yDestination = 7;

            Cell cellDestination = (Cell)customGame.Board.Board[xDestination, yDestination];

            cellDestination.CellType = CellType.Fish;


            Movements move   = new Movements(cellOrigin, cellDestination, customGame.Board);
            var       result = move.GetCoordinates();

            move.GetCoordinatesDownRight(result["origin"]);
            Assert.IsTrue(move.Possibilities[0].X == 0 && move.Possibilities[0].Y == 1);
            Assert.IsTrue(move.Possibilities[1].X == 1 && move.Possibilities[1].Y == 2);
            Assert.IsTrue(move.Possibilities[2].X == 1 && move.Possibilities[2].Y == 3);
            Assert.IsTrue(move.Possibilities[3].X == 2 && move.Possibilities[3].Y == 4);
            Assert.IsTrue(move.Possibilities[4].X == 2 && move.Possibilities[4].Y == 5);
            Assert.IsTrue(move.Possibilities[5].X == 3 && move.Possibilities[5].Y == 6);
            Assert.IsTrue(move.Possibilities[6].X == 3 && move.Possibilities[6].Y == 7);
        }
示例#2
0
        public void Test_CheckMove_ResultDownRight_BlockBy()
        {
            CustomGame customGame = InitGame();

            // Position of cell origin
            int xOrigin = 0;
            int yOrigin = 0;

            Cell cellOrigin = (Cell)customGame.Board.Board[xOrigin, yOrigin];

            cellOrigin.CellType       = CellType.FishWithPenguin;
            cellOrigin.CurrentPenguin = new Penguin(new Player("Player1", PlayerType.Human));

            // Position of cell destination
            int xDestination = 1;
            int yDestination = 2;

            Cell cellDestination = (Cell)customGame.Board.Board[xDestination, yDestination];

            cellDestination.CellType = CellType.Fish;

            // Position of cell after
            int xAfter = 1;
            int yAfter = 3;

            // set After
            Cell cellAfter = (Cell)customGame.Board.Board[xAfter, yAfter];

            cellAfter.CellType = CellType.Water;

            // launch move
            Movements move   = new Movements(cellOrigin, cellDestination, customGame.Board);
            var       result = move.GetCoordinates();

            // Tests
            move.GetCoordinatesDownRight(result["origin"]);
            Assert.IsTrue(move.Possibilities[0].X == 0 && move.Possibilities[0].Y == 1);
            Assert.IsTrue(move.Possibilities[1].X == 1 && move.Possibilities[1].Y == 2);
        }