My ReSharper NUnit Test Templates

Shout it

Much like my previous post about what I use for testing in Silverlight, I was recently asked on Twitter for my ReSharper NUnit templates.  I am posting them here if anyone finds them useful.

Basically, I write a LOT of tests every day.  These templates allow me to write tests faster.

New Test File Template

This file template adds a new “Test” target when you say tell Visual Studio to create a new file from template.  It populates your file with the correct namespaces and decorations to get you started.

Coding Templates

These are shortcuts that create new tests, setups, teardowns or assertions.  You just type the shortcut, hit tab, and the method or lines are created for you with your mouse cursor in the next place to type.  The shortcuts are:

  • test – Create a new [Test] method
  • setup – Create a [SetUp] method
  • teardown – Create a new [TearDown] method
  • ise – Assert that condition is equal to value
  • ist – Assert that condition is true
  • isf – Assert that condition is false
  • isn – Assert that condition is null
  • isnn – Assert that condition is not null

Download my ReSharper 4 NUnit templates.

2 Responses to “My ReSharper NUnit Test Templates”

  1. kleider says:

    kleider…

    [...]My ReSharper NUnit Test Templates « Brian Genisio's House of Bilz[...]…

  1. Janak says:

    Hi,
    I use this template. Its quite useful. But atm its a hinderance. As soon as I type the ‘tab’ key. instead of tabbing, it inserts this template. Can you advice how to change the key combination for this?

    Much appreciated,
    Janak

Leave a Reply