Skip to content

Latest commit

 

History

History
51 lines (37 loc) · 1.9 KB

binary.md

File metadata and controls

51 lines (37 loc) · 1.9 KB

Verification of binary data

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");
}

snippet source | anchor

For a FileStream the extension is not required:

[Fact]
public Task FileStream() =>
    Verify(File.OpenRead("sample.txt"));

snippet source | anchor

DiffTool

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:

Image Diff

Initial diff

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.