Extends Verify to allow verification of WinForms UIs.
Перейти к файлу
dependabot[bot] 458a57e30b
Bump Polyfill from 7.4.1 to 7.5.0 in /src (#825)
2024-11-19 14:08:21 +00:00
.github refs or cleanup 2024-03-03 10:49:54 +11:00
src Bump Polyfill from 7.4.1 to 7.5.0 in /src (#825) 2024-11-19 14:08:21 +00:00
.gitignore refs 2022-03-04 19:02:57 +11:00
code_of_conduct.md Update code_of_conduct.md 2020-07-25 09:58:56 +10:00
license.txt Update license.txt 2020-07-25 08:58:07 +10:00
readme.md Move to only net48 and net8 (#747) 2024-04-09 12:17:26 +10:00

readme.md

Verify.WinForms

Discussions Build status NuGet Status

Extends Verify to allow verification of WinForms UIs.

See Milestones for release notes.

NuGet package

https://nuget.org/packages/Verify.WinForms/

Usage

[ModuleInitializer]
public static void Init() =>
    VerifyWinForms.Initialize();

snippet source | anchor

Form

A visual element (Form/Control etc) can be verified as follows:

[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:

ContextMenuStrip

A ContextMenuStrip can be verified as follows:

[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:

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:

Icon

Gem designed by Adnen Kadri from The Noun Project.