Kata
Golden Master on Gilded Rose Kata by Emily Bache
Create a Golden Master for the Gilded Rose kata. You can find the repository here: https://github.com/emilybache/GildedRose-Refactoring-Kata.
Hints:
Read input from a file.
Redirect output to a file. In this case, the output of the system is the console. To capture the system output, we can redirect the console to an in-memory stream and then save the stream to a file.
C#
var streamwriter = new StreamWriter(new FileStream(“/location/out.txt”, FileMode.Create)); streamwriter.AutoFlush = true; Console.SetOut(streamwriter);
Java
System.setOut(new PrintStream(new BufferedOutputStream(new FileOutputStream(“/location/out.txt”)), true));
Python
import sys sys.stdout = open('/location/out.txt', 'w')
Ruby
$stdout = File.new('/location/out.txt', 'w') $stdout.sync = true