A snippet for Visual Studio 2017/2019 to help developers write unit tests using C# MsTest or XUnit.
- Download testmethod.snippet
- In Visual Studio, go to
Tools>Code Snippets Manager
- Select
CSharp Language
- Click on "Import..." button and select the
testmethod.snippet
file - You don't need to restart Visual Studio. Fortunatly, Visual Studio reloads a snippets on the fly.
- The snippet gives you 3 shortcuts:
- mstest - creates a test method with ms test template
- xfact - creates a test method with xunit fact template
- xtheory - creates a test method with xunit theory template
Example using xfact: