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); }
public void RepeatedMethodCallDoNotChangeBehaviour() { var board = BoardParser.ParseBoardByLines(_testBoardLines); var chesProblem = new ChessProblem(board); Assert.AreEqual(ChessStatus.Check, chesProblem.CalculateChessStatus()); // Now check that internal board modifications during the first call do not change answer Assert.AreEqual(ChessStatus.Check, chesProblem.CalculateChessStatus()); }
private void TestOnFile(string filename) { Board board = parser.ParseBoard(File.ReadAllLines(filename)); chessProblem = new ChessProblem(board); var expectedAnswer = File.ReadAllText(Path.ChangeExtension(filename, ".ans")).Trim(); chessProblem.CalculateChessStatus(PieceColor.White); Assert.AreEqual(expectedAnswer, chessProblem.ChessStatus.ToString().ToLower(), "Failed test " + filename); }
private static void TestOnFile(string filename) { var boardLines = File.ReadAllLines(filename); var board = BoardParser.ParseBoardByLines(boardLines); var chesProblem = new ChessProblem(board); var expectedAnswer = File.ReadAllText(Path.ChangeExtension(filename, ".ans")).Trim(); var resultStatus = chesProblem.CalculateChessStatus(); Assert.AreEqual(expectedAnswer, resultStatus.ToString().ToLower(), "Failed test " + filename); }
private static void TestOnFile(string filename) { var lines = File.ReadAllLines(filename); var board = new BoardParser().ParseBoard(lines); var ch = new ChessProblem(board); var expectedAnswer = File.ReadAllText(Path.ChangeExtension(filename, ".ans")).Trim(); ch.GetChessStatusFor(PieceColor.White); Assert.AreEqual(expectedAnswer, ch.GetChessStatusFor(PieceColor.White).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); }
public void RepeatedMethodCallDoNotChangeBehaviour() { var lines = new[] { " ", " ", " ", " q ", " K ", " Q ", " ", " ", }; var board = new BoardParser().ParseBoard(lines); var ch = new ChessProblem(board); Assert.AreEqual(ChessStatus.Check, ch.GetChessStatusFor(PieceColor.White)); // Now check that internal board modifictions during the first call do not change answer ch.GetChessStatusFor(PieceColor.White); Assert.AreEqual(ChessStatus.Check, ch.GetChessStatusFor(PieceColor.White)); }