https://github.com/VerifyTests/Verify.WinForms
Extends Verify to allow verification of WinForms UIs.
https://github.com/VerifyTests/Verify.WinForms
Last synced: 7 months ago
JSON representation
Extends Verify to allow verification of WinForms UIs.
- Host: GitHub
- URL: https://github.com/VerifyTests/Verify.WinForms
- Owner: VerifyTests
- License: mit
- Created: 2020-03-04T07:54:45.000Z (over 6 years ago)
- Default Branch: main
- Last Pushed: 2025-11-11T10:39:40.000Z (7 months ago)
- Last Synced: 2025-11-11T12:17:03.655Z (7 months ago)
- Language: C#
- Homepage:
- Size: 820 KB
- Stars: 6
- Watchers: 1
- Forks: 0
- 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
- awesome-dotnet-winforms - Verify.WinForms
README
#
Verify.WinForms
[](https://github.com/orgs/VerifyTests/discussions)
[](https://ci.appveyor.com/project/SimonCropp/verify-winforms)
[](https://www.nuget.org/packages/Verify.WinForms/)
Extends [Verify](https://github.com/VerifyTests/Verify) to allow verification of WinForms UIs.
**See [Milestones](../../milestones?state=closed) for release notes.**
## Sponsors
### Entity Framework Extensions
[Entity Framework Extensions](https://entityframework-extensions.net/?utm_source=simoncropp&utm_medium=Verify.WinForms) is a major sponsor and is proud to contribute to the development this project.
[](https://entityframework-extensions.net/?utm_source=simoncropp&utm_medium=Verify.WinForms)
## NuGet
* https://nuget.org/packages/Verify.WinForms
## Usage
```cs
[ModuleInitializer]
public static void Init() =>
VerifyWinForms.Initialize();
```
snippet source | anchor
### Form
A visual element (Form/Control etc) can be verified as follows:
```cs
[Test]
public Task FormUsage() =>
Verify(new MyForm());
```
snippet source | anchor
With the state of the element being rendered as a verified file:
[TheTests.FormUsage.Net.verified.png](/src/Tests/TheTests.FormUsage.Net.verified.png):

### ContextMenuStrip
A `ContextMenuStrip` can be verified as follows:
```cs
[Test]
public Task ContextMenuStrip()
{
var menu = new ContextMenuStrip();
var items = menu.Items;
items.Add(new ToolStripMenuItem("About"));
items.Add(new ToolStripMenuItem("Exit"));
return Verify(menu);
}
```
snippet source | anchor
With the state of the element being rendered as a verified file:
[TheTests.FormUsage.Net.verified.png](/src/Tests/TheTests.ContextMenuStrip.Net.verified.png):

## OS specific rendering
The rendering of Form elements can very slightly between different OS versions. This can make verification on different machines (eg CI) problematic. There are several approaches to mitigate this:
* Using a [custom comparer](https://github.com/VerifyTests/Verify/blob/master/docs/comparer.md)
## Icon
[Gem](https://thenounproject.com/term/gem/2247823/) designed by [Adnen Kadri](https://thenounproject.com/adnen.kadri/) from [The Noun Project](https://thenounproject.com).