VSTS doesn't have a pure set of Test Driven Development features, but using the built-in refactoring support for C# you are able to get a good Test Driven Development experience in VSTS 2005. Test Driven Development is a methodology we greatly believe in at Microsoft, new Test Driven Development specific features might show up in future releases.

Here’s how you can use refactoring to generate shipping code from a Unit Test in VSTS. Let’s say, I need to test class A that has method “string GetData()”. I start from writing the test for it:

[TestClass]
public class ATest
{
   
[TestMethod
]
   
public void
GetDataTest()
   
{
      
A a = new A
();
      
string
s = a.GetData();
      
Assert.AreEqual("my data", s, "Wrong data returned!"
);
   }
}

I want to generate the A.GetData from this test. Well, since class A does not exist yet, I create it manually as:

public class A
{
}

All I have to do now is right-click a.GetData() in my test and select “Generate Method Stub” from context menu:

It generates the following code:

public class A
{
   internal string
GetData()
   {
      throw new Exception("The method or operation is not implemented."
);
   }
}

Now I can run the test and make sure it fails. Then I will implement GetData, run my test and fix the code, until the test passes.