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."));
        }
Exemple #2
0
 static void Main(string[] args)
 {
     TemplateMethodExample.Run();
 }