https://github.com/spectresystems/spectre.verify.extensions
Extensions for Verify
https://github.com/spectresystems/spectre.verify.extensions
Last synced: 6 months ago
JSON representation
Extensions for Verify
- Host: GitHub
- URL: https://github.com/spectresystems/spectre.verify.extensions
- Owner: spectresystems
- License: mit
- Created: 2021-01-05T10:10:15.000Z (over 5 years ago)
- Default Branch: main
- Last Pushed: 2025-03-22T18:39:48.000Z (over 1 year ago)
- Last Synced: 2025-12-22T03:49:20.228Z (7 months ago)
- Language: C#
- Size: 34.2 KB
- Stars: 6
- Watchers: 2
- Forks: 2
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Funding: .github/funding.yml
- License: LICENSE.md
Awesome Lists containing this project
README
# Spectre.Verify.Extensions

[](https://www.nuget.org/packages/Spectre.Verify.Extensions/)
Add an attribute driven file naming convention to [Verify](https://github.com/VerifyTests/Verify).
## NuGet package
https://nuget.org/packages/Spectre.Verify.Extensions/
## Usage
At startup pass `Expectations.Initialize` to [VerifierSettings.DerivePathInfo](https://github.com/VerifyTests/Verify/blob/master/docs/naming.md#derivepathinfo):
```cs
public static class VerifyConfig
{
[ModuleInitializer]
public static void Init()
{
Verifier.DerivePathInfo(Expectations.Initialize);
}
}
```
snippet source | anchor
Then the following test
```cs
[ExpectationPath("Foo")]
public static class ExpectationTests
{
public static class MyOtherTestClass
{
[ExpectationPath("Bar/Qux")]
public class MyOtherOtherTestClass
{
[Fact]
[Expectation("Waldo")]
public async Task Test1()
{
await Verifier.Verify("w00t");
}
}
}
[ExpectationPath("Baz")]
public class YetAnotherTestClass
{
[Fact]
[Expectation("Corgi", "Lol")]
public async Task Test1()
{
await Verifier.Verify("lol");
}
}
}
```
snippet source | anchor
Will produce the following directory structure:
```
ProjectDir
- Expectations
- Foo
- Bar
- Qux
- Waldo.Output.verified.txt
- Baz
- Corgi.Lol.verified.txt
```