Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Installing nUnit with ASP.Net MVC 1.0

Does anyone have any advice/information on how to install nUnit with ASP.Net MVC? I have seen previous posts which related to the preview releases and involved a ghoulish nightmare of having to create template files, run command prompt and even mess with the registry.

Obviously this is far from ideal and given Microsoft's intention to allow any testing framework I was hoping that it was a much improved process in the full release. Googling seems to return results from when MVC was in the preview stage though! This is for Visual Studio 2008 Pro.

Cheers :)

Edit: Seems maybe not: http://msdn.microsoft.com/en-us/library/dd381614.aspx

Edit 2:: Ok found this: http://blogs.msdn.com/webdevtools/archive/2008/05/30/asp-net-mvc-preview-3-tooling-updates.aspx - They offer some templates and after installing the batch file it appears to show up in the drop down list when adding a new MVC application. However it was designed for the preview release of MVC so it's not ideal. Again, anyone who has better advice please post :)

like image 323
Damien Avatar asked Apr 06 '09 11:04

Damien


3 Answers

Download it here and follow the steps in the read me file to install it.

Here's the overview of how I did it.

  1. Unzip the MVC test project template that comes with visual studio, MvcWebApplicationTestProjectTemplatev1.cs.zip.
  2. Changed HomeController.cs and AccountController.cs files to the NUnit syntax, such as, [TestClass] to [TestFixture], etc....
  3. Updated the references in MvcApplicationTest.csproj to for NUnit.Framework.
  4. Tweaked the MvcWebApplicationTestProjectTemplate.cs.vstemplate file changing NamePackage, Description, Icon Package, and Defaut Name.

Once you get it zipped back up you will need to open up the Visual Studio Command Prompt and type devenv /setup to register the template with visual studio.

You will need to create a registry entry so visual studio knows where the new template lives.

If I ever get a blog I will be happy to update my answer with a detailed post. It's a little involved to put it here...Goolish ain't the word :).

like image 165
Ray Womack Avatar answered Sep 20 '22 01:09

Ray Womack


ScottGu just released some updated NUnit templates for ASP.NET MVC 1.0. All you need to do is run the enclosed installNUnit.cmd file.

like image 20
cdmckay Avatar answered Sep 19 '22 01:09

cdmckay


I have posted a guide and a update to Joe Cartano post on this, so that it works with MVC 2.0.

http://www.dalsoft.co.uk/blog/index.php/2009/11/17/nunit-templates-for-asp-net-mvc-2-0-preview-2/

like image 35
DalSoft Avatar answered Sep 19 '22 01:09

DalSoft