Kevin Dente's Blog

The Blip in the Noise
VS2005 C# Code Snippets for NUnit
Many moons ago, James Newkirk posted some VS2005 code snippets for unit testing with Team System's unit test framework. I'm a NUnit user, so I converted those snippets to use NUnit constructs. I'm sure I'm not the first to do this, but I haven't seen anything similar posted yet, so if anyone else is interested, here they are. To use them, simply copy them to either the "My Documents\Visual Studio 2005\Code Snippets\VC#\My Code Snippets" folder or the "Program Files\Microsoft Visual Studio 8\VC#\Snippets\1033\Visual C#" folder (the latter makes it available to everyone on the machine).

On a related note, although VS2005 Code Snippets are easy to use and very nicely integrated, I do wish they had a little bit more flexibility. In particular, they don't have a way of transforming user input in the snippets. I've used QuickCode.NET for code expansions in the past, and it lets you do things like take a snippet parameter and convert the first character to lower case in the expanded text. That little extra bit of flexibility allows you to, for example, generate a property declaration by only entering a single string, the property name, with the snippet automatically creating the appropriately named private backing field with the correct casing.
 

Published Thursday, May 5, 2005 9:34 PM by kevindente

Comments

# re: VS2005 Code Snippets for NUnit@ Friday, May 6, 2005 11:07 AM

Can you mention how to install those snippets? for not initiated among us :)

Alex