public void FullCleanup() { Console.Input.Enqueue("12"); Console.Input.Enqueue(ConsoleKey.Enter); var value = ReadlineConfiguration.Create <int>() .WithPrompt("My prompt: ") .WithCleanup(cleanup: ReadlineCleanup.RemoveAll) .Read(Console); Assert.AreEqual(12, value); Assert.AreEqual(new ConsolePoint(0, 0), Console.GetCursorPosition()); AssertConsole.BufferAndWindowLines(); }
public void BarelyOverflow() { var width = Console.WindowWidth; var word = "abcde"; var line = string.Join("", System.Linq.Enumerable.Repeat(word, width / word.Length + 1)).Substring(0, width); Console.Input.Enqueue(line); Console.Input.Enqueue(ConsoleKey.Enter); var value = ReadlineConfiguration.Create <string>() .Read(Console); AssertConsole.BufferAndWindowLines ( line ); }