public void WriteAndClear() { var capture = new ConsoleCapture(); HConsole.WriteAndClear(); Assert.That(HConsole.Text.Length, Is.Zero); HConsole.WriteAndClear(); Assert.That(HConsole.Text.Length, Is.Zero); HConsole.Configure(x => x.Set(xx => xx.Verbose())); HConsole.WriteLine(this, "meh"); Assert.That(HConsole.Text.Length, Is.GreaterThan(0)); using (capture.Output()) { HConsole.WriteAndClear(); } Assert.That(HConsole.Text.Length, Is.Zero); Assert.That(capture.ReadToEnd(), Does.EndWith("meh" + Environment.NewLine)); HConsole.WriteLine(this, "meh"); Assert.That(HConsole.Text.Length, Is.GreaterThan(0)); using (capture.Output()) { HConsole.Clear(); } Assert.That(HConsole.Text.Length, Is.Zero); Assert.That(capture.ReadToEnd().Length, Is.Zero); HConsole.WriteLine(this, "meh"); using (capture.Output()) { using (HConsole.Capture()) { } } Assert.That(HConsole.Text.Length, Is.Zero); Assert.That(capture.ReadToEnd(), Does.EndWith("meh" + Environment.NewLine)); }