Exemplo n.º 1
0
        public void TestPawnUpMoveInTableBorders()
        {
            List<Figure> figures = new List<Figure>();
            figures.Add(new Pawn(new Position(0, 0), 'A'));
            figures.Add(new Pawn(new Position(0, 2), 'B'));
            figures.Add(new Pawn(new Position(0, 4), 'C'));
            Pawn newPawn = new Pawn(new Position(3, 4), 'D');
            figures.Add(newPawn);
            King newKing = new King(new Position(4, 5));
            figures.Add(newKing);
            GameBoard gameBoard = new GameBoard(figures);
            Engine currentEngine = new Engine(gameBoard, figures);
            Position newPosition = currentEngine.GetNewCoordinates(newPawn, Direction.UR) ;

            Assert.IsFalse(currentEngine.ValidateCommand("DUR"), "You can't move in this direction");
        }
Exemplo n.º 2
0
        public void TestPawnImpossibleMove()
        {
            List<Figure> figures = new List<Figure>();
            figures.Add(new Pawn(new Position(0, 0), 'A'));
            figures.Add(new Pawn(new Position(0, 2), 'B'));
            figures.Add(new Pawn(new Position(0, 4), 'C'));
            Pawn newPawn = new Pawn(new Position(3, 4), 'D');
            figures.Add(newPawn);
            King newKing = new King(new Position(4, 5));
            figures.Add(newKing);
            GameBoard gameBoard = new GameBoard(figures);
            Engine currentEngine = new Engine(gameBoard, figures);
            Position newPosition = currentEngine.GetNewCoordinates(newPawn, Direction.DR) ;

            Assert.IsNull(newPosition, "You can't move here,cell is busy");
        }
Exemplo n.º 3
0
 public void TestPawnImpossibleOutOfBorderMove()
 {
     List<Figure> figures = new List<Figure>();
     figures.Add(new Pawn(new Position(0, 0), 'A'));
     figures.Add(new Pawn(new Position(0, 2), 'B'));
     figures.Add(new Pawn(new Position(0, 4), 'C'));
     figures.Add(new Pawn(new Position(0, 6), 'D'));
     King newKing = new King(new Position(3, 7));
     figures.Add(newKing);
     GameBoard gameBoard = new GameBoard(figures);
     Engine currentEngine = new Engine(gameBoard, figures);
     Assert.IsNull(currentEngine.GetNewCoordinates(newKing, Direction.UR), "You can't move here");
 }
Exemplo n.º 4
0
        public void TestKingPossibleMove()
        {
            List<Figure> figures = new List<Figure>();
            figures.Add(new Pawn(new Position(0, 0), 'A'));
            figures.Add(new Pawn(new Position(0, 2), 'B'));
            figures.Add(new Pawn(new Position(0, 4), 'C'));
            figures.Add(new Pawn(new Position(0, 6), 'D'));
            King newKing = new King(new Position(3, 7));
            figures.Add(newKing);
            GameBoard gameBoard = new GameBoard(figures);
            Engine currentEngine = new Engine(gameBoard, figures);
            bool isNewPosition=(currentEngine.GetNewCoordinates(newKing, Direction.UL))is Position ;

            Assert.IsTrue(isNewPosition, "You can move here");
        }