An open API service indexing awesome lists of open source software.

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.

Awesome Lists containing this project

README

          

# Verify.WinForms

[![Discussions](https://img.shields.io/badge/Verify-Discussions-yellow?svg=true&label=)](https://github.com/orgs/VerifyTests/discussions)
[![Build status](https://ci.appveyor.com/api/projects/status/lgjcs6xhxhhw0f02?svg=true)](https://ci.appveyor.com/project/SimonCropp/verify-winforms)
[![NuGet Status](https://img.shields.io/nuget/v/Verify.WinForms.svg)](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.

[![Entity Framework Extensions](https://raw.githubusercontent.com/VerifyTests/Verify.WinForms/refs/heads/main/docs/zzz.png)](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).