VS.NET 2005 Code Snippets rock!

Security Briefs

Syndication

fix[TAB][TAB]Widget[TAB]widget[ENTER]

That's all it takes to pop the following code into a C# source file in VS.NET 2005:

using NUnit.Framework;
[TestFixture]
public class TestWidget
{
    Widget widget;
    [SetUp]
    public void Setup()
    {
        widget = new Widget();
    }
    [Test]
    public void MyTest()
    {
        |
    }
}

The pipe shows where your cursor ends up after you type that key sequence - you're ready to type your first test.

If you have Beta 2 of VS.NET you really should take a quick look at the snippet HOWTO and the snippet schema reference, so you can create these things yourself. They are trivial to build, and you'll save lots of time in the long run if you codify some of your more repetitive key sequences. The one thing that bums me out is that there are some features (like adding assembly references automatically) that are only supported in VB.NET - bah!


Posted May 31 2005, 11:05 PM by keith-brown
Filed under:

Comments

Jonathan de Halleux wrote re: VS.NET 2005 Code Snippets rock!
on 05-31-2005 11:57 PM
Snippy is a great tool to generate snippets.

http://blogs.msdn.com/gusperez/articles/93681.aspx
Dody Gunawinata wrote re: VS.NET 2005 Code Snippets rock!
on 06-10-2005 11:05 AM
Snippet is not as useful as http://www.dvxp.com/en/QuickCode.aspx due to it's lack of parameter passing.

"fix[TAB][TAB]Widget[TAB]widget[ENTER]" could be
replaced by

"fix Widget ctrx+x" instead

rido wrote re: VS.NET 2005 Code Snippets rock!
on 07-18-2005 8:03 AM
Are you using NUnit with VS2005? Is there a binary version for .Net2.0?

Why don't use the testing fx included with Whidbey?
Keith Brown wrote re: VS.NET 2005 Code Snippets rock!
on 07-18-2005 8:22 AM
Rido,

Yes, I'm using NUnit. Why? Because the project started way before VSTS was even close to being usable.

How do you get NUnit to run on Whidbey? Download the source code and build it against the new framework, fixing the few compiler complaints that pop up. It's pretty easy.

Add a Comment

(required)  
(optional)
(required)  
Remember Me?