开发者

Run a method in Visual Studio with ReSharper

I just watched a recording of a conference presentation. The presenter was using VS 2010 and ReSharper. He had a shortcut to run the method in which the cu开发者_开发知识库rsor was. How is it done?

Thanks


That was my presentation, thanks for watching. I use TestDriven.NET which has the wonderful ability to run any method, not just attributed test methods. After you install TestDriven simply right click inside the method you want to run and select 'Run Tests'.

I map that command to F8. Tools->Options->Environment->Keyboard find the command TestDriven.NET.RunTests and assign it to the key you want to use.

Now you can just write a method, and with the cursor in it, hit F8 and run it. If the method writes to the console (Console.WriteLine) the output will show up in the output window. Almost, but not quite, as good as having a REPL :)

TestDriven is also the best test driver for NUnit. I don't like fancy graphical test drivers (like Resharper's) they just get in the way. All you really want to know is if any tests have failed. TestDriven will run all your unit tests and output a simple summary to the console.


I guess you're talking about Unit Tests, if so, you should assign it manually from the Tools->Options Window then Environment->Keyboard, search for ReSharper.ReSharper_UnitTest_RunContext and assign it with your preferred shortcut.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜