Binary data can be verified by passing a stream.
To know how to treat the stream, an extension needs to be provided:
[Fact]
public Task StreamWithExtension()
{
var stream = new MemoryStream(File.ReadAllBytes("sample.png"));
return Verify(stream, "png");
}
For a FileStream
the extension is not required:
[Fact]
public Task FileStream() =>
Verify(File.OpenRead("sample.txt"));
A Diff Tool will only be displayed if one can be found that supports the defined extension.
For example if Beyond Compare is detected the following will be displayed:
The majority of diff tools require two files to render a diff. When doing the initial verification there is no ".verified." file available. As such when doing the initial verification an "empty file", of the specified extension, will be used. The list of supported empty file can be seen at EmptyFiles. If no empty file can be found for a given extension, then no diff will be displayed.