Skip to content

Extends ApprovalTests for approval of Windows Forms through screenshot verification.

License

Notifications You must be signed in to change notification settings

approvals/ApprovalTests.Net.WinForms

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

ApprovalTests.WinForms

Build status NuGet Status

Extends ApprovalTests for approval of Windows Forms through screenshot verification.

The NuGet package NuGet Status

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

PM> Install-Package ApprovalTests.WinForms

Usage

WinFormsApprovals.Verify(new Form());

snippet source | anchor

System Differences

Usually Approval files take the form:

ClassName.MethodName.approved.extension

However, as WinForms will render differently on each OS, when approving with WinForms it will take the form

ClassName.MethodName.osname.approved.extension

It does this before each run by calling

ApprovalResults.UniqueForOs;

snippet source | anchor

An Example Approval File would be:

WinFormTests.TestControlApproved.Microsoft_Windows_10_Home_N.approved.png

Customizing System Naming

If you would like a different naming system you can customize the default naming.

For example, if you would like to use the the users name you could do this:

WinFormsApprovals.RegisterDefaultAdditionalInfo(ApprovalResults.UniqueForUserName);

snippet source | anchor

Would yield:

"WinFormTests.DemoAlternativeMachineSpecific.ForUser.Tomas";

snippet source | anchor

Read more on EnvironmentSpecificTest here

About

Extends ApprovalTests for approval of Windows Forms through screenshot verification.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Contributors 4

  •  
  •  
  •  
  •  

Languages