Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Visual Studio 2008 unit tests and nunit

When you right click on a method in a code file in Visual Studio 2008 you get this
alt text
which creates the unit test skeleton for that method.

Is there a way (by means of a template change or some nifty hack) by which I can change this to create unit tests based on Nunit rather than Visual Studio unit testing tools?
Something like this…

using System.Collections;
using NUnit.Framework;

    namespace Domain.UnitTest
    {
      [TestFixture]
      public class ManagerTest
      {
        [Test]
        public void SomethingTest()
        {
          string expected = null;
          string acutal = Something.Create();
          Assert.AreEqual(expected, acutal);
        }
like image 850
Cherian Avatar asked Apr 02 '09 17:04

Cherian


1 Answers

Try modifying the file C:\Program Files\Microsoft Visual Studio 9.0\Common7\IDE\ItemTemplatesCache\CSharp\1033\SimpleUnitTest.zip\SimpleUnitTest.cs (after making a backup, of course). Keep a copy of your updated version elsewhere as this may get overwritten by updates.

FWIW -- I found this by searching for the string using Microsoft.VisualStudio.TestTools.UnitTesting; inside files starting at the top level directory of the VS application directory.

like image 186
tvanfosson Avatar answered Sep 30 '22 12:09

tvanfosson