<!-- GENERATED FILE - DO NOT EDIT This file was generated by [MarkdownSnippets](https://github.com/SimonCropp/MarkdownSnippets). Source File: /docs/mdsource/binary.source.md To change this file edit the source file and then run MarkdownSnippets. --> # 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: <!-- snippet: StreamWithExtension --> <a id='snippet-StreamWithExtension'></a> ```cs [Fact] public Task StreamWithExtension() { var stream = new MemoryStream(File.ReadAllBytes("sample.png")); return Verify(stream, "png"); } ``` <sup><a href='/src/Verify.Tests/StreamTests.cs#L91-L100' title='Snippet source file'>snippet source</a> | <a href='#snippet-StreamWithExtension' title='Start of snippet'>anchor</a></sup> <!-- endSnippet --> For a `FileStream` the extension is not required: <!-- snippet: FileStream --> <a id='snippet-FileStream'></a> ```cs [Fact] public Task FileStream() => Verify(File.OpenRead("sample.txt")); ``` <sup><a href='/src/Verify.Tests/StreamTests.cs#L102-L108' title='Snippet source file'>snippet source</a> | <a href='#snippet-FileStream' title='Start of snippet'>anchor</a></sup> <!-- endSnippet --> ## DiffTool A [Diff Tool](https://github.com/VerifyTests/DiffEngine/blob/main/docs/diff-tool.md) 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: <img src="image-diff-result.png" alt="Image Diff" width="400"> ## 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](/src/Verify.Xunit/EmptyFiles). If no empty file can be found for a given extension, then no diff will be displayed.