API Reference
Class
GoldenFile
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) #Returns:
StringA readable description of where two texts differ.
Parameters
- path System.String
- The golden file (for the message).
- expected System.String
- The golden text.
- actual System.String
- The text produced now.
Returns
The description.
public static Void Match(String path, String actual) #Returns:
VoidCompares text with a golden file; throws GoldenFileMismatchException when they differ.
Parameters
- path System.String
- The golden file.
- actual System.String
- The text produced now.
Inherited Methods
public virtual Boolean Equals(Object? obj) #Returns:
BooleanInherited from Object
Parameters
- obj Object?
Properties
public static Boolean 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