public void WriteLine_OverflowScreenSpace_ResetCursorPosition() { TextUI ui = new TextUI(40, 40); // Cursor line position initially is 1. (The top index is the ### header) for (int i = 1; i < ui.MaximumCursorPosition(); ++i) { ui.WriteLine("write a line added."); // Check each time we write a line, the cursor position gets incremented. Assert.AreEqual(ui.CurrentCursorPosition(), i + 1); } ui.WriteLine("write one more line."); // By now we should have overflowed the TextUI cursor line index. We check to make // sure that happened. Assert.AreEqual(ui.CurrentCursorPosition(), 1); return; }
public void WriteLine_ValidFooter_IncreaseCursorPosition() { // Arrange. TextUI ui = new TextUI(40, 40); ui.Footer = "Test Footer"; int startCursorPosition = ui.CurrentCursorPosition(); // Act. int currentCursorPosition = ui.WriteLine("valid string"); // Assert. The first Writeline should return the cursor position + 1. Assert.AreEqual(startCursorPosition + 1, currentCursorPosition); }