The latest contract I’m working on has me writing some unit tests for some legacy code. Someone had previously built an MS Test project for most of what I’ve been working on, using the handy “Create Unit Tests…” context menu item in Visual Studio 2010, which stubs out unit tests for methods in your code.
Once I had exhausted the list of auto-generated unit test methods and moved onto a project where no one had previously generated tests, I went looking for this generation method myself. Strangely enough, I found it missing.
It took me a while to poke around on the web and find a couple of different solutions, but the best post I was able to find on the subject is here (Firedancer Unleashed blog), wherein she describes exactly how to get the full functionality of that context-menu command, including the context-menu entry itself, back up and running.
Pay special attention to the “Caveats!” section near the bottom; she describes how to get the functionality working if you are getting errors or see the entry but it’s disabled. In my case, I had already added a Unit Test project to my solution and had already added classes for some tests, but apparently you have to add a “Unit Test” via the Add > New Item method before this option will be available.
Check it out and enjoy.