public void RepeatedMethodCallDoNotChangeBehaviour() { var boardLines = new[] { " ", " ", " ", " q ", " K ", " Q ", " ", " ", }; ChessProblem chessProblem = new ChessProblem(); //var board = new BoardParser().ParseBoard(boardLines); chessProblem.LoadFrom(boardLines); chessProblem.CalculateChessStatus(PieceColor.White); Assert.AreEqual(ChessStatus.Check, chessProblem.ChessStatus); // Now check that internal board modifications during the first call do not change answer chessProblem.CalculateChessStatus(PieceColor.White); Assert.AreEqual(ChessStatus.Check, chessProblem.ChessStatus); }
private static void TestOnFile(string filename) { var board = File.ReadAllLines(filename); ChessProblem.LoadFrom(board); var expectedAnswer = File.ReadAllText(Path.ChangeExtension(filename, ".ans")).Trim(); var status = ChessProblem.CalculateChessStatus(); Assert.AreEqual(expectedAnswer, status.ToString().ToLower(), "Failed test " + filename); }
private static void TestOnFile(string filename) { var chessProblem = new ChessProblem(); var boardLines = File.ReadAllLines(filename); chessProblem.LoadFrom(boardLines); //var board = new BoardParser().ParseBoard(boardLines); var expectedAnswer = File.ReadAllText(Path.ChangeExtension(filename, ".ans")).Trim(); chessProblem.CalculateChessStatus(PieceColor.White); Assert.AreEqual(expectedAnswer, chessProblem.ChessStatus.ToString().ToLower(), "Failed test " + filename); }
public void RepeatedMethodCallDoNotChangeBehaviour() { var boardLines = new[] { " ", " ", " ", " q ", " K ", " Q ", " ", " ", }; ChessProblem.LoadFrom(boardLines); ChessProblem.CalculateChessStatus(); Assert.AreEqual(ChessStatus.Check, ChessProblem.ChessStatus); // Now check that internal board modifications during the first call do not change answer ChessProblem.CalculateChessStatus(); Assert.AreEqual(ChessStatus.Check, ChessProblem.ChessStatus); }