public void Constructor_Should_InitializeWithInitialPosition() { // Arrange SUT board = new SUT(); // Act string fen = board.GetFEN(); // Assert Assert.AreEqual(SUT.INITIAL_FEN_POSITION, fen); }
public void GetFEN_Should_Return_CorrectFenString(string expectedFEN) { // Arrange SUT board; // Act board = new SUT(expectedFEN); // Assert Assert.AreEqual(expectedFEN, board.GetFEN()); }
public void Move_Should_ResetEnPassant(string fen, string nextMove) { // Arrange var board = new SUT(fen); // Act board.Move(board.SANToMove(nextMove)); fen = board.GetFEN(); // Assert Assert.AreEqual("-", new FEN(fen).EnPassant); }
public void LoadFEN_Should_InitializeTheBoard(string expectedFEN) { // Arrange SUT board = new SUT(); // Act board.Clear(); board.LoadFEN(expectedFEN); // Assert Assert.AreEqual(expectedFEN, board.GetFEN()); }
public void Reset_Should_ResetAndSetupInitialPosition() { // Arrange SUT board = new SUT("2rq1rk1/ppp2ppp/n3bn2/1B1pp1B1/1b1PP3/2N2N2/PPP1QPPP/2KRR3 w - - 0 1"); // Act board.Reset(); // Assert Assert.AreEqual(SUT.INITIAL_FEN_POSITION, board.GetFEN()); Assert.AreEqual(ChessColor.White, board.Turn); Assert.AreEqual(ChessCastling.KingSide | ChessCastling.QueenSide, board.GetCastlingRights(ChessColor.White)); Assert.AreEqual(ChessCastling.KingSide | ChessCastling.QueenSide, board.GetCastlingRights(ChessColor.Black)); }
public void Clear_Should_ResetTheState() { // Arrange SUT board = new SUT("rnbqkbnr/pppp1ppp/8/4p3/4P3/8/PPPPKPPP/RNBQ1BNR b kq - 1 2"); // Act board.Clear(); // Assert Assert.AreEqual("8/8/8/8/8/8/8/8 w - - 0 1", board.GetFEN()); Assert.AreEqual(ChessColor.White, board.Turn); Assert.AreEqual(ChessCastling.None, board.GetCastlingRights(ChessColor.White)); Assert.AreEqual(ChessCastling.None, board.GetCastlingRights(ChessColor.Black)); }
public void Constructor_Should_InitializeWithGivenPosition(string expectedFen, string expectedSide, ChessCastling expectedCastlingForWhite, ChessCastling expectedCastlingForBlack) { // Arrange SUT board = new SUT(expectedFen); // Act string fen = board.GetFEN(); // Assert Assert.AreEqual(expectedFen, fen); Assert.AreEqual(expectedSide, board.Turn == ChessColor.White ? "w" : "b"); Assert.AreEqual(expectedCastlingForWhite, board.GetCastlingRights(ChessColor.White)); Assert.AreEqual(expectedCastlingForBlack, board.GetCastlingRights(ChessColor.Black)); }