public void PlayerUnbeatablePlaysFirstAndMarksCenter() { Board board = CreateBoard(); PlayerUnbeatable playerUnbeatable = CreatePlayerUnbeatable(); board.MarkBoard(playerUnbeatable.Play(board)); Assert.AreEqual(playerUnbeatable.Marker, board.GetMarkAtPosition(1, 1)); }
public void PlayerUnbeatablePlaysSecondWithCenterEmptyAndMarksCenter() { Board board = CreateBoard(); const Marker marker = Marker.X; board.MarkBoard(CreatePlay(1, 0, marker)); PlayerUnbeatable playerUnbeatable = CreatePlayerUnbeatable(); board.MarkBoard(playerUnbeatable.Play(board)); Assert.AreEqual(playerUnbeatable.Marker, board.GetMarkAtPosition(1, 1)); }
public void WinInDiagonalUpToDownRightToLeft() { Board board = CreateBoard(); const Marker marker = Marker.O; board.MarkBoard(CreatePlay(2, 0, marker)); board.MarkBoard(CreatePlay(1, 1, marker)); PlayerUnbeatable playerUnbeatable = CreatePlayerUnbeatable(); board.MarkBoard(playerUnbeatable.Play(board)); Assert.AreEqual(playerUnbeatable.Marker, board.GetMarkAtPosition(0, 2)); }
public void AvoidDefeatInDiagonalLineUpToDownLeftToRight() { Board board = CreateBoard(); const Marker marker = Marker.X; board.MarkBoard(CreatePlay(0, 0, marker)); board.MarkBoard(CreatePlay(1, 1, marker)); PlayerUnbeatable playerUnbeatable = CreatePlayerUnbeatable(); board.MarkBoard(playerUnbeatable.Play(board)); Assert.AreEqual(playerUnbeatable.Marker, board.GetMarkAtPosition(2, 2)); }
public void AvoidDefeatInHorizontalLine(int horizontalLine) { Board board = CreateBoard(); const Marker marker = Marker.X; board.MarkBoard(CreatePlay(0, horizontalLine, marker)); board.MarkBoard(CreatePlay(1, horizontalLine, marker)); if (horizontalLine != 1) { board.MarkBoard(CreatePlay(1, 1, Marker.O)); } PlayerUnbeatable playerUnbeatable = new PlayerUnbeatable(Marker.O); board.MarkBoard(playerUnbeatable.Play(board)); Assert.AreEqual(playerUnbeatable.Marker, board.GetMarkAtPosition(2, horizontalLine)); }
public void AvoidDefeatInVerticalLine(int verticalLine) { Board board = CreateBoard(); const Marker marker = Marker.X; board.MarkBoard(CreatePlay(verticalLine, 0, marker)); board.MarkBoard(CreatePlay(verticalLine, 1, marker)); if (verticalLine != 1) { board.MarkBoard(CreatePlay(1, 1, Marker.O)); } PlayerUnbeatable playerUnbeatable = CreatePlayerUnbeatable(); board.MarkBoard(playerUnbeatable.Play(board)); Assert.AreEqual(playerUnbeatable.Marker, board.GetMarkAtPosition(verticalLine, 2)); }