Migrating from NUnit to Unit Test Framework in Visual Studio 2005 Beta 2
Visual Studio 2005 Beta 2 includes an integrated testing framework which includes, among other types of tests, support for unit tests.
It proved to be very simple to migrate NUnit based tests to this new framework.
Here are the changes that had to be made to individual test files:
|
NUnit Syntax |
Visual Studio 2005 Syntax |
|
using NUnit.Framework; |
using Microsoft.VisualStudio.QualityTools.UnitTesting.Framework; |
|
[TestFixture] |
[TestClass] |
|
[Test] |
[TestMethod] |
|
Assertion.AssertEqual |
Assert.AreEqual |
|
Assertion.Assert |
Assert.IsTrue |
The only hiccup I experienced was an unexplained “Invalid character in path” error dialog which appeared initially when trying to run the test project. The problem vanished after removing all the test files from the project and re-adding them one at a time.