Esempio n. 1
0
        public void Test_CheckMove_ResultRight_AllRow()
        {
            // Init Game
            CustomGame customGame = InitGame();

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

            // Set Origin cell
            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 = 7;
            int yDestination = 0;

            // Set destination cell
            Cell cellDestination = (Cell)customGame.Board.Board[xDestination, yDestination];

            cellDestination.CellType = CellType.Fish;

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

            // Tests
            move.GetCoordinatesRight(result["origin"]);
            Assert.IsTrue(move.Possibilities[0].X == 1 && move.Possibilities[0].Y == 0);
            Assert.IsTrue(move.Possibilities[1].X == 2 && move.Possibilities[1].Y == 0);
            Assert.IsTrue(move.Possibilities[2].X == 3 && move.Possibilities[2].Y == 0);
            Assert.IsTrue(move.Possibilities[3].X == 4 && move.Possibilities[3].Y == 0);
            Assert.IsTrue(move.Possibilities[4].X == 5 && move.Possibilities[4].Y == 0);
            Assert.IsTrue(move.Possibilities[5].X == 6 && move.Possibilities[5].Y == 0);
            Assert.IsTrue(move.Possibilities[6].X == 7 && move.Possibilities[6].Y == 0);
        }
Esempio n. 2
0
        public void Test_CheckMove_ResultRight_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 = 2;
            int yDestination = 0;

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

            cellDestination.CellType = CellType.Fish;

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

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

            cellAfter.CellType = CellType.Water;

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

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