public void FactorialApprovalTests() { StringBuilder fakeoutput = new StringBuilder(); Console.SetOut(new StringWriter(fakeoutput)); Console.SetIn(new StringReader("a\n")); Console.WriteLine("1 -> " + Factorial.calculate(1)); Console.WriteLine("2 -> " + Factorial.calculate(2)); Console.WriteLine("3 -> " + Factorial.calculate(3)); Console.WriteLine("10 -> " + Factorial.calculate(10)); string output = fakeoutput.ToString(); Approvals.Verify(output); }