I'm just coming up to speed on .NET development, so take what I say with a grain of salt. And please let me know if I've made an error, or if you've got better suggestions.

Install Visual Studio

Express is the free, single-language edition. I installed the C# version. http://msdn2.microsoft.com/en-us/express/

Install NUnit

For creating unit tests for .NET code: http://nunit.com/ (not nunit.org, which lags behind)

Create NUnit shortcut within Visual Studio

In Visual Studio, under Tools -> External Tools... add:

Title:              NUnit
Command:            C:\Program Files\NUnit 2.4.4\bin\nunit.exe
Arguments:
Initial Directory:

Create a new project

If you don't know what type of project, choose "Class Library."

Create your first NUnit test fixture. Mine is SimpleTests.cs

using System;
using System.Collections.Generic;
using System.Text;
using NUnit.Framework;

namespace NUnitDemo
{

    [TestFixture]
    public class SimpleTests
    {
        [Test]
        public void TestNada()
        {
        }
    }
}

I don't know where the using System stuff came from. I suppose that's boilerplate from Project | Add Class.

Add the dependencies, in this case NUnit: Under Project | Add Reference... choose nunit.framework and press OK.

Run Build | Build Solution (F6).

Run the tests

Fire up the NUnit GUI. Run File | Open Project and traverse to where your project lives. If you haven't saved it, it's probably under your windows home directory in Local Settings\Application Data\Temporary Projects. Within the project, look in the bin\release directory for the dll named after the project.

Click the 'Run' button. Green bar?


See also WebAiiCheatSheet

CategoryCheatSheet

iDIAcomputing: VisualStudioCheatSheet (last edited 2009-07-27 18:26:05 by localhost)