Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Visual Studio shortcut for Create new Interface and Create new Basic Unit Test

In Visual Studio you can press SHIFT+ALT+C to create new class file. I am looking for similar shortcut for new interface file and new "basic unit test" file. I have Telerik JustCode so please do not suggest simillar product. But if a small extension exists for example, it would be nice to know. BTW I am using Visual Studio 2010 (C#).

like image 551
Pol Avatar asked Jun 15 '12 14:06

Pol


2 Answers

There are no built-in solutions for this, but you can easily record macros (In the Tools menu):

enter image description here

You can rename them in the Macro Explorer (Alt+F8)

You can then assign shortcuts to those macros in ToolsOptionsKeyboard.

EDIT This doesn't work for adding a new Basic Unit Test. You'll only get to the New Test selection dialog, even with this method.

like image 136
Joey Avatar answered Oct 19 '22 17:10

Joey


Rather than using a macro, I would advice you to look into the Code Snippet Manager. It enables you to set up a template of text with "holes" in it. And assign the template to a "key" - a short text (which can be autocompleted). When the key is typed the template replaces the key and the holes can easily be filled out. Further, you can add macro-like functionality to it, to automatically get the current filename or class or date pre-filled.

Visual studio actually is shipped with C# snippets for "Test class" and "Test method".

See also http://msdn.microsoft.com/en-us/library/ms165393(v=vs.100).aspx

Finally, the code snippet support in Resharper (http://www.jetbrains.com/resharper/) is much better than the one in visual studio. Definitely worth checking out. A real productivity boost!

like image 32
Carlo V. Dango Avatar answered Oct 19 '22 15:10

Carlo V. Dango