public void Initialize() { //TODO:Extract to another class and interface this.players = provider.GetPlayers(Constants.StandardNumberOfPlayers); Validator.ValidateGameInitialization(this.players, this.board); var firstPlayer = players[0]; IFigure king = new KingFigureFactory().CreateFigure(FigureSign.K); firstPlayer.AddFigure(king); this.board.AddFigure(king, new Position(Constants.initialKingRow, Constants.initialKingColumn)); var secondPlayer = players[1]; IFigure pawnA = new PawnFigureFactory().CreateFigure(FigureSign.A); IFigure pawnB = new PawnFigureFactory().CreateFigure(FigureSign.B); IFigure pawnC = new PawnFigureFactory().CreateFigure(FigureSign.C); IFigure pawnD = new PawnFigureFactory().CreateFigure(FigureSign.D); secondPlayer.AddFigure(pawnA); secondPlayer.AddFigure(pawnB); secondPlayer.AddFigure(pawnC); secondPlayer.AddFigure(pawnD); this.board.AddFigure(pawnA, new Position(Constants.pawnAInitialRow, Constants.pawnAInitialCol)); this.board.AddFigure(pawnB, new Position(Constants.pawnBInitialRow, Constants.pawnBInitialCol)); this.board.AddFigure(pawnC, new Position(Constants.pawnCInitialRow, Constants.pawnCInitialCol)); this.board.AddFigure(pawnD, new Position(Constants.pawnDInitialRow, Constants.pawnDInitialCol)); this.SetFirstPlayerIndex(); this.renderer.RenderBoard(this.board); }
public void CheckIfTheMoveMethodChangeTheKurDirectionCorrectly() { List<IPlayer> players = new List<IPlayer>(); players.Add(new KingPlayer("king")); players.Add(new PawnPlayer("pawn")); IBoard board = new Board(); var firstPlayer = players[0]; IFigure king = new KingFigureFactory().CreateFigure(FigureSign.K); firstPlayer.AddFigure(king); board.AddFigure(king, new Position(Constants.initialKingRow, Constants.initialKingColumn)); var secondPlayer = players[1]; IFigure pawnA = new PawnFigureFactory().CreateFigure(FigureSign.A); IFigure pawnB = new PawnFigureFactory().CreateFigure(FigureSign.B); IFigure pawnC = new PawnFigureFactory().CreateFigure(FigureSign.C); IFigure pawnD = new PawnFigureFactory().CreateFigure(FigureSign.D); secondPlayer.AddFigure(pawnA); secondPlayer.AddFigure(pawnB); secondPlayer.AddFigure(pawnC); secondPlayer.AddFigure(pawnD); board.AddFigure(pawnA, new Position(Constants.pawnAInitialRow, Constants.pawnAInitialCol)); board.AddFigure(pawnB, new Position(Constants.pawnBInitialRow, Constants.pawnBInitialCol)); board.AddFigure(pawnC, new Position(Constants.pawnCInitialRow, Constants.pawnCInitialCol)); board.AddFigure(pawnD, new Position(Constants.pawnDInitialRow, Constants.pawnDInitialCol)); Move move = firstPlayer.Move("kur", board); var expectedRow = 6; Assert.AreEqual(move.To.Row, expectedRow); }
public void CheckIfTheMoveMethodThrowsCorrectlyWhenTheCommandIsNotExactlyThreeSymbols() { List<IPlayer> players = new List<IPlayer>(); players.Add(new PawnPlayer("pawn")); players.Add(new KingPlayer("king")); IBoard board = new Board(); var firstPlayer = players[0]; IFigure king = new KingFigureFactory().CreateFigure(FigureSign.K); firstPlayer.AddFigure(king); board.AddFigure(king, new Position(Constants.initialKingRow, Constants.initialKingColumn)); var secondPlayer = players[1]; IFigure pawnA = new PawnFigureFactory().CreateFigure(FigureSign.A); IFigure pawnB = new PawnFigureFactory().CreateFigure(FigureSign.B); IFigure pawnC = new PawnFigureFactory().CreateFigure(FigureSign.C); IFigure pawnD = new PawnFigureFactory().CreateFigure(FigureSign.D); secondPlayer.AddFigure(pawnA); secondPlayer.AddFigure(pawnB); secondPlayer.AddFigure(pawnC); secondPlayer.AddFigure(pawnD); board.AddFigure(pawnA, new Position(Constants.pawnAInitialRow, Constants.pawnAInitialCol)); board.AddFigure(pawnB, new Position(Constants.pawnBInitialRow, Constants.pawnBInitialCol)); board.AddFigure(pawnC, new Position(Constants.pawnCInitialRow, Constants.pawnCInitialCol)); board.AddFigure(pawnD, new Position(Constants.pawnDInitialRow, Constants.pawnDInitialCol)); secondPlayer.Move("shshs", board); }
public void CheckIfCreateFigureKingWorksCorrectly() { var king = new KingFigureFactory().CreateFigure(FigureSign.K); var kingAdrian = new King(FigureSign.K); Assert.AreEqual(king.Sign, kingAdrian.Sign); }
public void CheckIfTheMoveMethodThrowsCorrectlyIfTheCommandIsThreeSymbolsLongButStillNotCorrect() { var player = new KingPlayer("Serafim"); IBoard board = new Board(); IFigure king = new KingFigureFactory().CreateFigure(FigureSign.K); board.AddFigure(king, new Position(Constants.initialKingRow, Constants.initialKingColumn)); player.Move("aaa", board); }