public void TestTakeBlackB2B7() { var chessBoard = Game001; var moveValidator = new ChessMoveValidator(chessBoard, "B2B7"); moveValidator.Validate(); Assert.AreEqual(1, moveValidator.GetAllErrors().Count); }
public void TestTakeWiteB5C4() { var chessBoard = Game001White; var moveValidator = new ChessMoveValidator(chessBoard, "B5C4"); moveValidator.Validate(); Assert.AreEqual(0, moveValidator.GetAllErrors().Count); }
public void TestMoveFromEmptyFieldNotOk() { var chessBoard = ChessBoard.NewGameWhite; var moveValidator = new ChessMoveValidator(chessBoard, "C3C5"); moveValidator.Validate(); Assert.AreEqual(1, moveValidator.GetAllErrors().Count); }
public void TestBlackO3NotOk() { var chessBoard = ChessBoard.NewGameBlack; var moveValidator = new ChessMoveValidator(chessBoard, "C2C5"); moveValidator.Validate(); Assert.AreEqual(1, moveValidator.GetAllErrors().Count); }
public void TestMoveWhiteVezSkrzPesaky01() { var chessBoard = ChessBoard.NewGameWhite; var moveValidator = new ChessMoveValidator(chessBoard, "A8A6"); moveValidator.Validate(); Assert.AreEqual(1, moveValidator.GetAllErrors().Count); }
public IActionResult OnPost() { gameState = persistenceService.LoadBoard(Game); var moveValidator = new ChessMoveValidator(gameState, Step); moveValidator.Validate(); foreach (var error in moveValidator.GetAllErrors()) { ModelState.AddModelError("step", error); } if (!ModelState.IsValid) { return(Page()); } moveValidator.MakeMove(); persistenceService.SaveBoard(Game, gameState); return(Page()); }