public void TestCornerEndgame2() { Piece[][] board = new Piece[8][] { new Piece[8] { o, o, o, o, o, o, o, o }, new Piece[8] { o, o, o, o, o, o, o, o }, new Piece[8] { o, o, o, o, o, o, o, o }, new Piece[8] { o, o, o, o, o, o, o, o }, new Piece[8] { o, o, o, o, o, o, o, o }, new Piece[8] { o, o, o, o, o, o, o, o }, new Piece[8] { qw, kb, o, o, o, o, o, o }, new Piece[8] { kw, qw, o, o, o, o, o, o } }; AtomarChessGame game = new AtomarChessGame(board, Player.Black); Assert.False(game.IsInCheck(Player.Black)); Assert.False(game.IsInCheck(Player.White)); Assert.True(game.IsValidMove(new Move("B2", "B1", Player.Black))); Assert.True(game.IsValidMove(new Move("B2", "A2", Player.Black))); Assert.False(game.IsValidMove(new Move("B2", "A1", Player.Black))); game.MakeMove(new Move("B2", "B1", Player.Black), true); Assert.True(game.IsDraw()); Assert.AreEqual(2, game.PiecesOnBoard.Count); }
public void TestKingsNextToEachOther() { Piece[][] board = new Piece[8][] { new Piece[8] { o, o, o, o, o, o, o, o }, new Piece[8] { o, o, o, o, o, o, o, o }, new Piece[8] { o, o, o, o, o, o, o, o }, new Piece[8] { o, o, o, pb, nb, o, o, o }, new Piece[8] { o, o, o, pw, pb, o, o, o }, new Piece[8] { o, o, o, o, o, nw, o, o }, new Piece[8] { o, o, o, o, o, o, o, o }, new Piece[8] { o, o, kb, o, kw, o, o, o } }; AtomarChessGame game = new AtomarChessGame(board, Player.White); Assert.True(game.IsValidMove(new Move("E1", "D1", Player.White))); game.MakeMove(new Move("E1", "D1", Player.White), true); Assert.False(game.IsInCheck(Player.Black)); Assert.False(game.IsInCheck(Player.White)); Assert.False(game.IsValidMove(new Move("C1", "D1", Player.Black))); Assert.True(game.IsValidMove(new Move("C1", "D2", Player.Black))); Assert.True(game.IsValidMove(new Move("C1", "C2", Player.Black))); }