NUnit test method snippet

As I develop, I write quite a few unit tests. And to speed up the development I’m using code snippets. One of them most useful snippets for testing is to create test method. So I’ve came up with ntest snippet that will give you decorated public method.

Type ntest

ntest snippet for NUnit test method

and hit TAB. And you get ready test method:

Test method decorated and ready to go

Then you’ll need to type the test name and hit enter – your cursor will be placed inside of the curly braces. Here is the snippet file: ntest.snippet

To install the snippet in Visual Studio, you’ll need to go Tools -> Code Snippets Manager. Pick a folder where you would like new snippet to be stored. Click “Import..” button and point to the unzipped ntest.snippet file. Done. Profit!

More about creating your own snippets read on Microsoft Walkthrough: Creating a Code Snippet
Code Snippets Schema Reference