Esempio n. 1
0
        public void SnowmanNumberOfMoves_HasNotMovedYetOnEmptyBoard_ThreePossibleMoves()
        {
            var board   = new BasePiece[8, 8];
            var Snowman = new Snowman()
            {
                Color = Color.White, Location = new Vector(0, 3)
            };

            board[0, 3] = Snowman;
            var possibleMoves = Snowman.GetMoves(board).Length;

            Assert.AreEqual(5, possibleMoves);
        }
Esempio n. 2
0
        public void SnowmanCanJumpOverFriendlyPieces_ReturnsTrue()
        {
            var board   = new BasePiece[8, 8];
            var Snowman = new Snowman()
            {
                Color = Color.White, Location = new Vector(0, 3)
            };

            board[0, 3] = Snowman;
            board[0, 0] = new Rook()
            {
                Color = Color.White, Location = new Vector(0, 0)
            };
            board[0, 7] = new Rook()
            {
                Color = Color.White, Location = new Vector(0, 7)
            };
            board[0, 1] = new Knight()
            {
                Color = Color.White, Location = new Vector(0, 1)
            };
            board[0, 6] = new Knight()
            {
                Color = Color.White, Location = new Vector(0, 6)
            };
            board[0, 2] = new Bishop()
            {
                Color = Color.White, Location = new Vector(0, 2)
            };
            board[0, 5] = new Bishop()
            {
                Color = Color.White, Location = new Vector(0, 5)
            };
            board[0, 4] = new King()
            {
                Color = Color.White, Location = new Vector(0, 4)
            };
            for (int i = 0; i < 8; i++)
            {
                board[1, i] = new Pawn()
                {
                    Color = Color.White, Location = new Vector(1, i)
                };
            }
            var possibleMoves = Snowman.GetMoves(board).Length;

            Assert.IsTrue(possibleMoves > 0);
        }
Esempio n. 3
0
        public void SnowmanCannotCaptureFriendlyPieceInFrontOfIt_ReturnsTrue()
        {
            var board   = new BasePiece[8, 8];
            var Snowman = new Snowman()
            {
                Color = Color.White, Location = new Vector(0, 3)
            };
            var Pawn = new Pawn()
            {
                Color = Color.White, Location = new Vector(2, 3)
            };

            board[0, 3] = Snowman;
            board[2, 3] = Pawn;
            var possibleMoves = Snowman.GetMoves(board).Length;

            Assert.IsTrue(possibleMoves == 4);
        }