private string VisibleCellsToString(TableView table) { StringBuilder buffer = new StringBuilder("["); int index = 0; for (TableViewCell cell = table.FirstVisibleCell; cell != null; cell = cell.NextCell) { ConsoleTextEntryView textCell = cell as ConsoleTextEntryView; Assert.IsNotNull(textCell); buffer.Append(textCell.Value); if (++index < table.VisibleCellsCount) { buffer.Append(", "); } } buffer.Append("]"); return(buffer.ToString()); }
internal void AssertVisibleRows(TableView table, params string[] values) { Assert.AreEqual(values.Length, table.VisibleCellsCount, "expected: " + StringArrayToString(values) + "\n" + "actual: " + VisibleCellsToString(table)); int index = 0; TableViewCell cell = table.FirstVisibleCell; TableViewCell lastCell = null; while (cell != null) { ConsoleTextEntryView textCell = cell as ConsoleTextEntryView; Assert.IsNotNull(textCell); Assert.AreEqual(values[index++], textCell.Value); lastCell = cell; cell = cell.NextCell; } Assert.AreEqual(values.Length, index); Assert.AreSame(lastCell, table.LastVisibleCell); }