Add helper for console
Closed this issue · 0 comments
dupdob commented
This proposal extends the scope of NFluent (somewhat).
Expected Behavior
One should be able to check the output to the Console with NFluent.
Such as
Console.Write("hello");
...
// this is not possible
Check.ThatConsole().IsEqualTo("hello");
Current Behavior
Nothing exists (within NFluent) to capture and check the output to the console.
Possible Solution
Using a mock is a solution, but it impacts design for simple code. NFluent should offer rely on the redirection features offered by the console.
Idea
using(var session = NFluent.NewConsoleSession())
{
Console.Write("hello");
Check.That(session.Output).IsEqualTo("hello");
}
Context
This idea occured to me while recording the TDD banking kata session. This idea probably needs refinements.