In Eclipse you can right click on a class (even if it is a web project) that has a main method and run or debug it. It facilitates for quick testing. In Visual Studio when you want to run a specific class, how do you do it, without having to change the start up class etc..?
Your title asks about unit testing, which I view as different from running a Main
method. For unit testing, I'd recommend ReSharper which lets you run individual tests, whole classes, whole namespace hierarchies, and whole assemblies (in terms of unit tests).
I don't typically write Main
methods for unit tests. Where I do write multiple Main
methods is for demoing code in talks - and for that, I've got a little helper in MiscUtil so that you can create one main method which calls into MiscUtil, and that presents a menu showing all the other static Main
methods in the assembly. Have a look at the downloadable source code for C# in Depth for an example.
I've used NUnit very successfully for exactly this sort of purpose. In general, writing a unit test in NUnit is quicker, simpler, and easier than writing a main() method on a class. Really, any Unit Test framework would fit this requirement; I've just used (and been very happy with) NUnit.
There is also a plugin for VS called testdriven.net that I have used in the past, which will more or less let you plug in your test framework of choice and run your tests from VS. It supports NUnit and MBUnit, I believe neither of which require a Main method. You just decorate classes as test fixtures and the framework can handle them independently.