Quick & Dirty Compatibility
You say this new unit testing tool in VS Team System is something that you want to use but you have a large number of existing tests in NUnit. For some reason you don’t have a great desire to walk through and change all the attribute names. Well, based on a few responses to My first unit test in Visual Studio Team System entry you might not have to do that much. The gist of the replies suggested that you simply could substitute the NUnit attribute names with the VS Team System attribute names. I thought I would try this out on the StackFixture code that is part of Chapter 2 in my Test-Driven Development in Microsoft .NET book. Here is the code:
// using NUnit.Framework;
using TestFixture = Microsoft.VisualStudio.QualityTools.
using Test = Microsoft.VisualStudio.QualityTools.
using SetUp = Microsoft.VisualStudio.QualityTools.
public class StackFixture
private Stack stack;
public void Init()
stack = new Stack();
public void Empty()
public void PushOne()
"After Push, IsEmpty should be false");
public void Pop()
"After Push - Pop, IsEmpty should be true");
public void PopEmptyStack()
// additional tests
All I had to do was comment out the using NUnit.Framework statement (part of me is in pain when I do this) and add the using statements for the various attributes and compile. The code compiles and when I run it all 14 tests pass. No changes to the code beyond the using statements. There are a few caveats, but it’s a start. I will be blogging more on issues with compatibility in the coming days.
This posting is provided "AS IS" with no warranties, and confers no rights.