public void Run_RunsExample() { var templateMethodExample = new TemplateMethodExample(this.consoleWorkersMock.Object); string outputString; using (var newOut = new StringWriter(CultureInfo.InvariantCulture)) { var previousOut = Console.Out; Console.SetOut(newOut); templateMethodExample.Run(CancellationToken.None); Console.SetOut(previousOut); outputString = newOut.ToString(); } Assert.That(outputString, Does.StartWith("Running template method example.")); }
static void Main(string[] args) { TemplateMethodExample.Run(); }