Class
GoldenFile
ConsoleMonster.Testing
Snapshot ("golden file") comparison for console output. The first run writes the file and fails so it gets reviewed; later runs compare and fail with a readable diff (the first differing line with context, both versions, and the column where they part). Set CONSOLEMONSTER_UPDATE_GOLDEN=1 to rewrite the files after an intended change. Line endings are normalised to \n; files are UTF-8 without a byte order mark.
Inheritance
- object
- GoldenFile
Methods
public static string Diff(string path, string expected, string actual) #A readable description of where two texts differ.
Parameters
- path string
- The golden file (for the message).
- expected string
- The golden text.
- actual string
- The text produced now.
Returns
string The description.public static void Match(string path, string actual) #Compares text with a golden file; throws GoldenFileMismatchException when they differ.
Parameters
- path string
- The golden file.
- actual string
- The text produced now.
Inherited Methods
Properties
public static bool Updating { get; } #Whether golden files are being rewritten in this process.
Fields
public const string UpdateVariable #The environment variable that rewrites golden files instead of comparing.
Value:
CONSOLEMONSTER_UPDATE_GOLDEN