To re-enable the Create Unit Tests… menu, go to Tools->Customize… to launch the Customize dialog. At the Customize dialog, go to the Commands tab, select the Context menu radio button and choose Editor Context Menus | Code Window.
You will realized that the menu item is actually available in the context menu. 🙂 The VS developers were kind enough to leave it there for us. *HeHe* Click on the Create Unit Tests… menu item and click either Move Up or Move Down. [Note: My screenshot is showing Create Unit Test in singular because I had previously tried to rename it]. Then click Close.
Restart Visual Studio 2012 and whalla! The context menu will be available!
Note: This apparently does not work in Visual Studio 2013.
Once installed, Within Visual Studio, Tools | Nunitit | NUnitit settings
Change NUnit-GUI Executable to install path: C:\Program Files\NUnit 2.5.5\bin\net-2.0\nunit.exe
When you want to run an NUnit test, set the NUnit project in VS.NET as startup project and navigate to Tools | Debug Nunit GUI. The Nunit test interface will then load.
From there you can execute your test cases.
Very simple example of NUnit test:
public class TestJHAServiceManager
public void GetJHANames()
List<string> strings = JHAServiceManager.GetJHANames("jUnit");
/// Gets the JHA details with invalid id.
/// Another example where an exception is expected
public void GetJHADetailsWithInvalidId()
JobHazardAnalysis jha = new JobHazardAnalysis()
Id = -25
Inline code is great.
You can update any site by just pushing out one file with your code in it, and all references to that file are set. However, the downside is that the capability that allows you to do that (on-demand compiling) is the same thing that holds you back when debugging if you compile the site before debugging (which is the default).
Even worse… debugging makes you compile every site, most of which aren’t even relevant to your test.
Luckily there’s an easy way around this.
1. Go to the property pages of your site (Solution Explorer > Right-click solution > Property Pages…).
2. On the “Build” tab, set the “Before running startup page” action to “No Build”
Do this for every web site in your solution except the one your localhost is set to. This should cut wait time down dramatically.