private void RenderGrid(int x, int y, IGameMember grid) { string[] gridLines = grid.GetTextRepresentation().Split('|'); if (this.styles.ContainsKey(GlobalConstants.GridBorderStyle)) { var style = this.styles[GlobalConstants.GridBorderStyle] as GridBorderStyle; var gridWithBorder = new GridWithBorder(grid, style); gridLines = gridWithBorder.GetTextRepresentation().Split('|'); } foreach (var line in gridLines) { this.PrintOnPosition(x, y++, line); } this.PrintOnPosition(0, ++y, GameMessages.EnterNumberToMove, RenderConstants.GameMessagesColor); this.ResetConsoleColor(); this.SaveCursorCurrentPosition(); }
public void TestGridWithBorderToReturnCorrectResult() { IGameMember grid = new Grid(); GridWithBorder gridBorder; for (int i = 0; i < this.styles.Length; i++) { var currentBorderStyleForTesting = this.styles[i]; gridBorder = new GridWithBorder(grid, currentBorderStyleForTesting); string result = gridBorder.GetTextRepresentation(); Assert.AreEqual(true, result.Contains(currentBorderStyleForTesting.Top) && result.Contains(currentBorderStyleForTesting.Bottom) && result.Contains(currentBorderStyleForTesting.Right) && result.Contains(currentBorderStyleForTesting.Left)); } }