Example #1
0
        public void Test_CheckMove_ResultUpLeft_BlockBy()
        {
            CustomGame customGame = InitGame();

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

            // Set origin
            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 = 6;
            int yDestination = 5;

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

            cellDestination.CellType = CellType.Fish;

            // Position of cell after
            int xAfter = 6;
            int yAfter = 4;

            // 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.GetCoordinatesUpLeft(result["origin"]);
            Assert.IsTrue(move.Possibilities[0].X == 7 && move.Possibilities[0].Y == 6);
            Assert.IsTrue(move.Possibilities[1].X == 6 && move.Possibilities[1].Y == 5);
        }
Example #2
0
        public void Test_CheckMove_ResultUpLeft_AllRow()
        {
            CustomGame customGame = InitGame();

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

            // Set Origin

            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 = 4;
            int yDestination = 0;

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

            cellDestination.CellType = CellType.Fish;

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

            // Tests
            move.GetCoordinatesUpLeft(result["origin"]);
            Assert.IsTrue(move.Possibilities[0].X == 7 && move.Possibilities[0].Y == 6);
            Assert.IsTrue(move.Possibilities[1].X == 6 && move.Possibilities[1].Y == 5);
            Assert.IsTrue(move.Possibilities[2].X == 6 && move.Possibilities[2].Y == 4);
            Assert.IsTrue(move.Possibilities[3].X == 5 && move.Possibilities[3].Y == 3);
            Assert.IsTrue(move.Possibilities[4].X == 5 && move.Possibilities[4].Y == 2);
            Assert.IsTrue(move.Possibilities[5].X == 4 && move.Possibilities[5].Y == 1);
            Assert.IsTrue(move.Possibilities[6].X == 4 && move.Possibilities[6].Y == 0);
        }