Ejemplo n.º 1
0
        BoardCell[,] GetDeepCopyOfBoardCells(BoardCell[,] boardCells)
        {
            var serializedChessboard  = JsonConvert.SerializeObject(boardCells);
            var deserializedBoarCells = JsonConvert.DeserializeObject <BoardCell[, ]>(serializedChessboard);

            ChessBoardBuilder.NormilizedBoardCells(deserializedBoarCells);

            return(deserializedBoarCells);
        }
Ejemplo n.º 2
0
        public void GetNormilizedBoardCellsTest()
        {
            ChessBoard initialChessBoard    = TestData.GetStartPositionChessBoard();
            string     serializedChessboard = initialChessBoard.GetSerializedChessBoard();

            ChessBoard deserialisedChessBoard = JsonConvert.DeserializeObject <ChessBoard>(serializedChessboard);

            ChessBoardBuilder.NormilizedBoardCells(deserialisedChessBoard.BoardCells);

            Assertions.AreBoardsMatch(initialChessBoard.BoardCells, deserialisedChessBoard.BoardCells);
        }