Monday, 8 April 2013

How to use NUnit Assert functionality in MS Tests

Today I realised that I'd forgotten how spoilt I am using Resharper and dotCover to run my unit tests. Put another way I'd forgotten how badly Visual Studio plays with any other unit test frameworks other than MS Test! I'm used to and really like the fluent API style of NUnit's Assert.That(...) syntax so having to fall back to MS Test always feels like a step back. If you ever find yourself in a situation where you can only run MS Tests, but want to use NUnit functionality you can easily do this just by using aliases on the NUnit "using" statements.

The following "using" code block facilitates this - you will be able to decorate your unit test classes with MS Test attributes so they can be picked up and run by Visual Studio whilst using NUnit functionality.

using Microsoft.VisualStudio.TestTools.UnitTesting;
using Assert = NUnit.Framework.Assert;
using Is = NUnit.Framework.Is;

Wednesday, 2 January 2013

MVC2 is not supported in Visual Studio 2012

The title pretty much says it all, there is no way to open an MVC2 project within Visual Studio 2012, there is no "auto upgrade" path either! If you attempt to convert a solution containing an MVC2 project you will probably see the following error message:

Subtype: '{F85E285D-A4E0-4152-9332-AB1D724D3325}' is unsupported by this installation.

If you do, then the only real solution appears to be graft the existing MVC2 project into an empty MVC3 or MVC4 project and update references accordingly - bit of a chore no matter what approach you choose / prefer.