# VerifyFile
Verifies the contents of a file.
```cs
[Fact]
public Task VerifyFilePath() =>
VerifyFile("sample.txt");
```
snippet source | anchor
## Optional Info
An optional `info` parameter can be supplied to add more context to the test. The instance passed will be json serialized.
```cs
[Fact]
public Task VerifyFileWithInfo() =>
VerifyFile(
"sample.txt",
info: "the info");
```
snippet source | anchor
## Using a custom extension
```cs
[Fact]
public Task VerifyFilePathWithExtension() =>
VerifyFile("sample.txt", extension: "csv");
```
snippet source | anchor
## Verify a file without using a unit test
Use the functionality of VerifyTests outside of a unit test.
```cs
public async Task VerifyExternalFile()
{
using var verifier = new InnerVerifier(targetDirectory, name: "sample");
await verifier.VerifyFile(filePath);
}
```
snippet source | anchor
Result:
```
{targetDirectory}/sample.verified.txt
```
## Verify Files
Verify multiple files using file name as the name for the verified file:
```cs
[Fact]
public Task Run() =>
VerifyFiles(["File1.txt", "File2.txt"]);
```
snippet source | anchor
### With info
```cs
[Fact]
public Task WithInfo() =>
VerifyFiles(
["File1.txt", "File2.txt"],
info: new
{
Key = "Value"
});
```
snippet source | anchor
### With File Scrubber
```cs
[Fact]
public Task WithFileScrubber() =>
VerifyFiles(
["File1.txt", "File2.txt"],
fileScrubber: (_, builder) =>
{
builder.Clear();
builder.Append("New");
});
```
snippet source | anchor