private void verify_game_against_golden_master() { for (int seed = 0; seed < NUMBER_OF_SEEDS; seed++) { try { StringWriter stdOut = StdOut.captureStdOut(); string goldenMaster = readFromGoldenMaster(seed); GameRunner.Run(new Random(seed)); Assert.That(stdOut.ToString(), Is.EqualTo(goldenMaster), "golden master mismatch for seed " + seed); } finally { StdOut.restoreStdOut(); } } }
#pragma warning restore 162 private void generate_golden_master() { Console.WriteLine(">>>>"); for (int seed = 0; seed < NUMBER_OF_SEEDS; seed++) { StringWriter stdOut; try { stdOut = StdOut.captureStdOut(); GameRunner.Run(new Random(seed)); } finally { StdOut.restoreStdOut(); } writeToGoldenMaster(stdOut.ToString(), seed); } Console.WriteLine("<<<<"); }
public void TearDown() { StdOut.restoreStdOut(); }