Unfortunately the standard framework in Visual Studio 2013 for doing unit testing is still MsTest. Even though I liked MsTest for some reasons it has been time to change. There are two important reasons:
- MonoDevelop does not support MsTest
- Microsoft does not use it any more and there haven't been any updates for a while
Some small projects may have no problem with MsTest, but AngleSharp for instance is an open-source project that aims to be developed (and used / tested) by developers, regardless of their IDE or operating system. Therefore NUnit seems like a superior choice.
We should also not forget that NUnit has a lot more assertations and helpers than MsTest. And finally it does not require any special kind of project type. It only requires a reference to the framework and corresponding attributes on classes and methods. That's it!
Converting AngleSharp has therefore as easy as the following steps:
- Installing the NuGet package of NUnit to the test library
- Simple search and replace of:
- A regular expression powered search and replace using
Assert.IsInstanceOf<$2>($1);There may be special cases that are not covered by the latter (like calling methods with multiple arguments), but these should be occurring quite rarely.
- Installing the NuGet package of NUnitTestAdapter to integrate with the test explorer
And that's it. It also makes sense to dereference the MsTest framework, as it is not (and should not be) used any more.