public void should_handle_line_breaks(string text, int expectedLines) { var writer = new ConsoleStatWriter(); Console.SetOut(writer); Console.Write(text); Assert.Equal(expectedLines, writer.Lines); }
public void should_redirect_and_stat() { var writer = new ConsoleStatWriter(); Console.SetOut(writer); Console.WriteLine("hello"); Console.WriteLine("world"); Assert.Equal(3, writer.Lines); }
public void should_handle_huge_amount_of_text_data() { var statWriter = new ConsoleStatWriter(); int totalLines = ushort.MaxValue; var writer = new HugeConsoleWriter(totalLines, statWriter); Stopwatch watch = Stopwatch.StartNew(); writer.Write(); watch.Stop(); output.WriteLine($"Elapsed Time: {watch.Elapsed:c}"); Assert.Equal(totalLines, statWriter.Lines); }
public void should_set_initial_lines() { var writer = new ConsoleStatWriter(); Assert.Equal(0, writer.Lines); }