开发者

What's the fastest way to test a code snippet in Visual Studio 2008?

开发者 https://www.devze.com 2023-01-02 18:55 出处:网络
My common scenario: I have a web app and a test project in the same solution. Maybe I\'m missing something, but I ca开发者_如何学运维n\'t test methods/snippets from the Immediate Window regardless of

My common scenario: I have a web app and a test project in the same solution. Maybe I'm missing something, but I ca开发者_如何学运维n't test methods/snippets from the Immediate Window regardless of which project. MSDN alleges you can't use syntax like

?TestMethod123(args)

from the Immediate Window while in web type project. So, why can't I throw a method in my test project (same solution, mind you) without the [TestMethod] attribute and get some output there?

Often, I find myself needing to quickly test the output (read: Console output) of a few lines of code, but it doesn't merit a whole unit test, or I don't want to clutter my pretty test project with junk code I don't initially understand in the first place. Does Visual Studio provide a way for me to quickly test code snippets?


For quick-and-dirty checking of some dubious code I use the Snippet Compiler, which works wonderfully for that purpose.

For running a single or just a few unit tests, I would recommend using Resharper, or TestDriven.NET. They are both commercial solution, but both are well worth the bucks, especially if used in a professional environment.

0

精彩评论

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