Verifies the contents of a file.
[Fact]
public Task VerifyFilePath() =>
VerifyFile("sample.txt");
An optional info
parameter can be supplied to add more context to the test. The instance passed will be json serialized.
[Fact]
public Task VerifyFileWithInfo() =>
VerifyFile(
"sample.txt",
info: "the info");
Use the functionality of VerifyTests outside of a unit test.
public async Task VerifyExternalFile()
{
var solutionDirectory = AttributeReader.GetSolutionDirectory();
var settings = new VerifySettings();
settings.DisableRequireUniquePrefix();
var sourceFile = Path.Combine(solutionDirectory, "Verify.Tests", "sample.txt");
Func<InnerVerifier, Task<VerifyResult>> verify = _ => _.VerifyFile(sourceFile, null);
await new SettingsTask(
settings,
async verifySettings =>
{
using var verifier = new InnerVerifier(sourceFile, verifySettings);
return await verify(verifier);
});
}