Andrew Stopford's Weblog

poobah

Sponsors

News

Articles

Family

Old Blogs

Microsoft MVC and MbUnit

You may recall ScottGu's post about the new feature in latest drop of the MS MVC framework that allows you to pick your unit test framework of choice. With Mix08 now wrapped up and the framework released I can show you what the MbUnit templates look like. You will need either MbUnit 2.4.2 or MbUnit 3.0 alpha 2, early previews of these are available if you really like the edge, but more stable drops are coming, with 2.4.2 installed here is what you will see.

When created you would see


The test project depends on the name of your project, for example "myproject" would be "myprojecttests" etc. The project is preloaded with your main project and a referance to the MbUnit.Framework dll. For the moment we have a default test for the controller, which looks like.

using MbUnit.Framework;

[TestFixture]
public class HomeControllerTests
{
    [Test]
    public void About()
    {
        //
        // TODO: Add test logic here
        //
    }
    [Test]
    public void Index()
    {
        //
        // TODO: Add test logic here
        //
    }
}
 
Notice default tests for your about and index page, these match the default about and index controllers. The template only referances what you need so you don't need to refactor out any unrequired referances.

Note that the MVC team has blogged about how to add and use NUnit templates including NUnit\Rhino templates. To save you some steps we have added the templates to the installers, I did an inital drop of the template but Jeff did all the work to make this happen and we would welcome your feedback.

Comments

Jeff Brown said:

Thanks Andy.

Besides the MVC templates, I also added ordinary templates for test projects and test fixtures.  Check 'em out!

# March 11, 2008 1:14 AM

Mark said:

Hey I just gave this a shot but don't get mbunit as an option.  I'm using visual web developer though, are there any templates available for it?

# June 13, 2008 8:14 AM