I have started using nunit and i find it very annoying to execute the entire app in order for the test class to compile so that i can test each test cases. Is there a way that i can just compile the test class alone or any other single csharp .cs class file alone.
Because this can be used for other user creat开发者_开发问答ed controls as well like for instance when we create our own inherited list view or button control to compile it i have to execute the entire project.
So is there a way to select one single class file and compile it either in visual studio 2010 or even in command line.
You can compile a single C# file using the Command Line Compiler (csc.exe). For details, see Command-line Building With csc.exe.
Note that, in practice, this is often of limited use. Most classes in projects have dependencies on other types inside the assembly, so it's often difficult to compile a single C# file into a usable form in a larger project without some of the other files.
I believe you are confusing and mixing the words execute and compile/build...
Anyway, the smallest compiling unit is the assembly or project so just create a test project as class library which contains all your unit test classes as .cs files and you can build it separately. This is in general also good design because tests should not be included in the project to test itself.
精彩评论