-
Notifications
You must be signed in to change notification settings - Fork 19
Reporting
The Beyond Compare, VsCode, KDiff and several other diff tools are supported out of the box. If the defaults don't work for you, you have two options: 1.
- Create a new
DiffReporter
Both options are described below.
For your test run, set an environment variable AssentDiffProgram
pointing to the diff program executable.
By default 2 arguments are supplied, the received file and the approved file, in that order. If your diff program requires them in a different order, or requires extra parameters, set the environment variable AssentDiffProgramArguments
. The format is a .NET string.Format
string with {0}
and {1}
being placeholders for the received and approved file respectively.
New diff programs can be added or the order thereof changed by
passing a new instance of DiffReporter
:
var programs = new[] {
new AnotherDiffProgram()
}
.Concat(DiffReporter.DefaultDiffPrograms)
.ToArray();
var reporter = new DiffReporter(programs);
configuration.UsingReporter(reporter);
If you have time, please submit a PR with your new reporter.
The reporter behaviour can also be modified to use something other than
a diff tool (for example a logger) by implementing IReporter
:
class LogReporter : IReporter
{
public void Report(string recieved, string approved)
{
Log.Warning("Expected {recieved}, Got {approved}", recieved, approved);
}
}
configuration.UsingReporter(new LogReporter());
Instead of implementing IReporter
, simple reporters can be specified using a delegate. For example:
configuration.UsingReporter(
(recieved, approved) =>
Log.Warning("Expected {recieved}, Got {approved}", recieved, approved)
);