https://github.com/verifytests/verify.docnet
Extends Verify to allow verification of documents via DocNet.
https://github.com/verifytests/verify.docnet
Last synced: 26 days ago
JSON representation
Extends Verify to allow verification of documents via DocNet.
- Host: GitHub
- URL: https://github.com/verifytests/verify.docnet
- Owner: VerifyTests
- License: mit
- Created: 2021-08-25T10:05:29.000Z (almost 5 years ago)
- Default Branch: main
- Last Pushed: 2025-04-07T10:20:32.000Z (about 1 year ago)
- Last Synced: 2025-04-07T11:28:17.414Z (about 1 year ago)
- Language: C#
- Homepage:
- Size: 1.32 MB
- Stars: 11
- Watchers: 1
- Forks: 2
- Open Issues: 0
-
Metadata Files:
- Readme: readme.md
- Funding: .github/FUNDING.yml
- License: license.txt
- Code of conduct: code_of_conduct.md
Awesome Lists containing this project
README
#
Verify.DocNet
[](https://github.com/orgs/VerifyTests/discussions)
[](https://ci.appveyor.com/project/SimonCropp/Verify-DocNet)
[](https://www.nuget.org/packages/Verify.DocNet/)
Extends [Verify](https://github.com/VerifyTests/Verify) to allow verification of documents via [DocNet](https://github.com/GowenGit/docnet).
**See [Milestones](../../milestones?state=closed) for release notes.**
Converts pdf documents to png for verification.
## Sponsors
### Entity Framework Extensions
[Entity Framework Extensions](https://entityframework-extensions.net/?utm_source=simoncropp&utm_medium=Verify.DocNet) is a major sponsor and is proud to contribute to the development this project.
[](https://entityframework-extensions.net/?utm_source=simoncropp&utm_medium=Verify.DocNet)
### Developed using JetBrains IDEs
[](https://jb.gg/OpenSourceSupport)
## NuGet
* https://nuget.org/packages/Verify.DocNet
## Usage
### Enable Verify.DocNet
```cs
[ModuleInitializer]
public static void Initialize()
{
VerifyDocNet.Initialize();
VerifierSettings.UseSsimForPng();
}
```
snippet source | anchor
`VerifyImageMagick.RegisterComparers` (provided by https://github.com/VerifyTests/Verify.ImageMagick) allows minor image changes to be ignored.
### Verify a file
```cs
[Test]
public Task VerifyPdf() =>
VerifyFile("sample.pdf");
```
snippet source | anchor
### Verify a Stream
```cs
[Test]
public Task VerifyPdfStream()
{
var stream = File.OpenRead("sample.pdf");
return Verify(stream, "pdf");
}
```
snippet source | anchor
### Result
[Samples.VerifyPdf#01.verified.png](/src/Tests/Samples.VerifyPdf%2300.verified.png):

## PreserveTransparency
```cs
[Test]
public Task VerifyPreserveTransparency() =>
VerifyFile("sample.pdf")
.PreserveTransparency();
```
snippet source | anchor
## PageDimensions
```cs
[Test]
public Task VerifyPageDimensions() =>
VerifyFile("sample.pdf")
.PageDimensions(new(1080, 1920));
```
snippet source | anchor
## VerifySinglePage
```cs
[Test]
public Task VerifyFirstPage()
{
var stream = File.OpenRead("sample.pdf");
return Verify(stream, "pdf").SinglePage(0);
}
[Test]
public Task VerifySecondPage()
{
var stream = File.OpenRead("sample.pdf");
return Verify(stream, "pdf").SinglePage(1);
}
```
snippet source | anchor
## File Samples
http://file-examples.com/
## Icon
[Pdf](https://thenounproject.com/term/pdf/533502/) designed by [Alfredo](https://thenounproject.com/AlfredoCreates) from [The Noun Project](https://thenounproject.com/).