Is the Visual Studio 2008 Object Test Bench useful for anything? - visual-studio

Is the Visual Studio 2008 Object Test Bench useful for anything? Maybe I'm missing something but aside from a flashy version of the immediate window, it doesn't seem like a developer would actually use it for anything.
(And how many people knew it existed in the first place?!)
In case you're wondering, the 'Object Test Bench' is located under 'View / Other Windows' in Visual Studio 2008.

I had never heard of it until you mentioned it - thanks for bringing it to my attention.
I do think it's useful. If I want to see how "stuff" works I usually drop my code into LINQPad and see what sort of results I get by doing a Dump() on the resulting object. Only problem is that you have to copy your whole class and supporting classes in there to get anything more than trivial stuff to work. Also, there's no intellisense in LINQPad.
This looks like it can replace what I use LINQPad for. Quick and dirty playing with the objects.

IIRC, you can use it for load/stress testing, but my only exposure to it was a quick demo way back at the Ready To Launch event for VS2005.

Object Test Bench is good for Unit Testing your code and pretty much lightweight. It exists in VS2005 too. I prefer NUNIT which is more powerful

Related

Extending Visual Studio's "Code Snippet" functionality

When I write a test method, I type "testm", hit tab and magically see:
[TestMethod]
public void MethodName()
{
}
When I type the methodName it is highlighted (can't show that here) as a "field" that I'm filling in. I'm sure you're all familiar with this behavior.
Personally, I like names for my test methods like
Can_My_Method_Do_That_Thing instead of CanMyMethodDoThatThing. I find them much easier to read, and most times they're really a sentence anyway.
For reasons I'd rather not get into, I have a difficult time typing all those _ characters and I'd like to be able to use the space bar, and have the spaces in the name automatically replaced when I hit "Enter".
I hear that Visual Studio is extendable and customizable and so on. Is it extensible enough to do this?
You can implement and use your own code snippets and Microsoft provides a very nice guide on how this could be done: Walkthrough: Implementing Code Snippets
To have a quick look at how the "testm" Expansion (that's the Snippet Type) is "partially" implemented you may go to c:\Program Files (x86)\Microsoft Visual Studio 10.0\VC#\Snippets\1033\Test\ directory and edit the testmethod.snippet file.
I have never implemented this kind of "Expansion" myself, but Microsoft's Extending the Editor website is a really good source of info of how this can be achieved. This is where you should start lookin'.
If you install CodeRush Xpress then not only do you get some great free productivity and refactoring tools but there is also an open source community of plugins for CodeRush Xpress.
I found this plugin that does (almost) exactly what you want.
The caveat is that it is developed for NUnit and not MSTest so you will get a [Test] attribute instead of a [TestMethod] attribute. Since this is open source, it should be fairly easy to modify the code to your requirements.
The best method i would suggest is look into the Editor extensibility and work it out. Following steps is what you might need to do.
Map a key to your "underscorize" action.
Using the editor extensibility points, you can get access to the Selected text, process it.
And finally replace it.
One suggestion. Though the learning curve might be a bit high with having to go through MEF and stuff like that. But its worth it.
Another approach worth considering would be to use an external tool to remap the keyboard. For example, it should be straightforward to get AutoHotKey to react to the testm[Tab] sequence of keystrokes and switch into a mode where it maps spaces to underscores (or deletes each space as soon as it's typed and adds an underscore). Similarly, the Enter key could switch it out of that mode again.

Resharper Compared with Visual Studio 2010

I've heard that Visual Studio 2010 = Visual Studio 2008 + Resharper. I'd like to know how true that is. I don't want to start using Resharper to accomplish superficial things, nor to accomplish things that VS 2010 now already handles. I'm sure Resharper 5.1.X offers features that VS 2010 does not have, but which of those - in your opinion - represent the true value-adds? Which of those "truly-valuable" features are available only in the licensed copy?
This is a 'joke' based on the fact that Microsoft supposedly released a screenshot of 2010 with ReSharper UI visible.
VS.Net 2010 definitely does not go any way towards making ReSharper redundant!
Resharper adds alot to VS2010. Just check out this comparison matrix.
I'm sure Resharper 5.1.X offers features that VS 2010 does not have, but which of those - in your opinion - represent the true value-adds? Which of those "truly-valuable" features are available only in the licensed copy?
All features are available in a non-licensed (demo) copy. Check out this post of what single feature people like about Resharper.
I know this is slightly off topic. However, as a response to whether VS2010 is making Resharper redundant;
I've upgraded ReSharper from 5.1 to 6 roughly 1 month after release. It got slower. To the point when I have to Suspend it occasionally - particularly when doing lots of work on JavaScript, CSS or larger template files (Razor). Sad thing is it just gets slower.
At home, I'm using just a plain VS2010 Professional without any add-ons. And it just feels like a breeze - everything is responsive and there are no hiccups when copy pasting (during manual re factoring). Admittedly at work I have T4MVC and Chirpy installed along Resharper.
Feature wise, what I'm using in ReSharper:
Auto usings (alt + Enter)
Cannot use auto include references as it gets it wrong 80% of the time
Refactor: initialize member variable from constructor parameter
Refactor: replace with LinQ expression
Sadly that's about it. In light of this, because of the slowdowns I'm considering dropping ReSharper altogether. This is my grievances:
Delay every time I copy a piece of code in order to move it - anything from half a second to 2 seconds. Please note the delay increases with project / solution size
Auto completion in JavaScript and CSS: 95% of the time it inserts code I don't want - in particular () after selecting an object property. Getting fed up having to delete the brackets each time
class name and id suggestion. This happens in CSS as well as Razor template. It will try to insert an existing class name / html id when you are in fact creating a new one. It will do this whenever you press space. Instead you have to press escape.
Pasting code. Again when refactoring manually and code is moved from one class to another it will keep pestering you with all missing usings. First you have to press Escape for "Insert all missing usings" and then once for every occurrence of a class without a reference. Usually you want to change something upon pasting code but this feature makes code unreadable with all the popups.
I could go on abut the things I find annoying with ReSharper. Not trying to offend any die-hard productivity tool enthusiasts, bottom line is VS2010 is on it's own a very decent IDE and a lot of ReSharper features can be found within it - though not always intuitively.
If you are just learning C# ReSharper is a great tool that helps you organize your code better. But if you've been working with .NET for a while you will most likely find it intrusive and hampering productivity on some occasions.
Re#er still got much stronger code check and refactoring options.

Snippet Designer/Editor for Visual Studio 2010

What Editors/Designers for creating Visual Studio 2010 Snippets are there?
I would like to be able to put in different replacements (ie spots where the text should be replaced). A low incidence of blocking bugs is also nice.
So far the only one I have seen is Snippet Editor 2.1. I am going to dig into it and see how it works, but I did not want to spend too much time on that app if there is a better one out there.
I like Snippet Designer by Matt Manela and chose to use it in my Extending Visual Studio course. I like the Snippet Explorer and searching snippets as well as the designer view to help you edit them, including replacements. It also gives you a nice Export as Snippet context menu item. And the code is on CodePlex if you would like to learn how it's done.
Go to the Visual Studio Gallery and search for "snippet" in the "Find" box. You should find several options (e.g. Snippet Designer, Snipper, etc.). I haven't used any of these so I can't attest to how good they may be but at least it's a start.
Hope this helps.
Resharper (not free) has it's own snippet system which is really great. I'm adding this answer because I was searching for something not realising I already had something installed (Resharper)

Is there anything like Eclipse Perspective in Visual Studio?

I was wondering if there's anything like Eclipse Perspectives in Visual Studio (2008 or 2010).
For those unfamiliar with Eclipse, here's a definition of Perspectives:
A perspective is a visual container
for a set of views and editors
(parts). These parts exist wholly
within the perspective and are not
shared. A perspective is also like a
page within a book. It exists within
a window along with any number of
other perspectives and, like a page
within a book, only one perspective is
visible at any time.
Let me give you a visual example:
Java Perspective:
SVN Repository Perspective:
Maybe there is nothing like that straight out of the box, but with some plugin. If that's the case, it'll also be a valid answer.
Thanks for your time.
I used Brian's blog post as a starting point and made a VS2010 extension: http://perspectives.codeplex.com/
More info here: http://csharpening.net/blog/?p=292
It's probably not as complete as the VSWindowManager but lets you save your configurations and create new ones. Let me know if it works out!
I found this http://vswindowmanager.codeplex.com/ but it's for 2005.. there is a branch for 2008 in the source code but i don't know if it works... I think I'll give it a try and post any results...
It would be great if it works also for 2010!!! When you work in 1024*768 it's really annoying to rezise the windows every two seconds!!!
Good luck!!
You can check out my blog post which provides the ability to list and switch window layouts in Vs2008 and Vs2010: http://www.brianschmitt.com/2010/09/save-and-change-tool-layout-in-visual.html

Need to debug LINQ simple queries in Visual Studio 2010

I often get in a position when I need to know why my LINQ doesnt work as intended...
I use object collections and extensions.
I dont want spend more than couple of minutes on it. LINQ supposed to make developer's life easier not harder.
I hoped VS 2010 will have it fixed but I now use RC and it still doesnt let me type LINQ and check what is going on... Says as before "Expression cannot contain lambda expressions"...
Is there some add-on for Visual Studio so I can quickly and effectively run ad-hoc queries and find out what is going on and where I am wrong?
It's not a VS plugin, but it's free and it's awesome: LinqPad
Check it out here
You can run whatever linq or code snippet in general, just give it a look, it's an incredibly useful tool, for linq and more.
Have you tried this?
Debugging LINQ Queries
Debugging LINQ queries can be
problematic. One of the reasons is
that quite often, you write a large
query as a single expression, and you
can’t set a breakpoint mid-expression.
Writing large queries in expression
context is particularly powerful when
using functional construction to form
XML (or using the strongly typed DOM
in Open XML SDK V2). This post
presents a little trick that makes it
easier to use the debugger with LINQ
queries that are written using ‘method
syntax’.
VS 2010 isn't going to address this..
There is, in fact, such a plugin as you describe, but unfortunately it is highly expiremental. You will probably need to install VS2008 SDK and the Service Packs to get it to work - I know I did..
Here is the link:
http://extendedimmediatewin.codeplex.com/

Resources