# AutoVerify
In some scenarios it makes sense to auto-accept any changes as part of a given test run. For example:
* Keeping a text representation of a Database schema in a `.verified.sql` file (see [Verify.SqlServer](https://github.com/VerifyTests/Verify.SqlServer)).
Note that auto accepted changes in `.verified.` files remain visible in source control tooling.
This can be done using `AutoVerify()`:
### Instance
```cs
var settings = new VerifySettings();
settings.AutoVerify();
```
snippet source | anchor
### Fluent
```cs
[Fact]
public Task AutoVerifyFluent() =>
Verify("Value")
.AutoVerify();
```
snippet source | anchor
### Globally
```cs
public static class ModuleInitializer
{
[ModuleInitializer]
public static void Init() =>
VerifierSettings.AutoVerify();
}
```
snippet source | anchor
### With a delegate
AutoVerify supports passing a delegate to control what subset of files to AutoVerify based on file path.
### Instance
```cs
var settings = new VerifySettings();
settings.AutoVerify(
verifiedFile =>
Path.GetExtension(verifiedFile) == "png");
```
snippet source | anchor
### Fluent
```cs
[Fact]
public Task AutoVerifyFluentDelegate() =>
Verify("Value")
.AutoVerify(
verifiedFile =>
Path.GetExtension(verifiedFile) == "png");
```
snippet source | anchor
### Globally
```cs
public static class ModuleInitializer
{
[ModuleInitializer]
public static void Init() =>
VerifierSettings.AutoVerify(
(typeName, methodName, verifiedFile) =>
Path.GetExtension(verifiedFile) == "png");
}
```
snippet source | anchor
## Throw when AutoVerify happens
By default, when AutoVerify is being used, the `.verified.` file will be silently replaced with no feedback to the user.
To get feedback when AutoVerify occurs, use `throwException: true`:
```cs
[Fact]
public Task AutoVerifyThrowException() =>
Verify("Value")
.AutoVerify(throwException: true);
```
snippet source | anchor
Using this approach the `.verified.` file will still be replaced, but an exception will be thrown to notify that it has occurred.
## AutoVerify on the build server
By default the same AutoVerify behavior applies both to local test runs and on the build server. To opt out of AutoVerify on the build server use `includeBuildServer: false`:
```cs
[Fact]
public Task AutoVerifyIncludeBuildServer() =>
Verify("Value")
.AutoVerify(includeBuildServer: false);
```
snippet source | anchor
This can be helpful when the requirement is to minimize the friction of accepting frequent local changes, but once checked in to source control then changes to any verified file should fail a test