I use HttpWebRequests pretty extensively - I've found that the Visual Studio Web Test classes (i.e. WebTestRequest and WebTestResponse etc) offer a lot of really nice methods that i'd love to start using.
But I can't seem to find a way to use these classes outside of the Visual Studio's testing framework. Has anyone done this?
Will,
WebTestRequest and WebTestResponse aren't designed to be used like HttpWebRequest and HttpWebResponse. They're mostly containers for passing various request and response data into and out of the web/load test engine in Visual Studio or MSTest.
I wrote both of the classes and even I find myself wishing I could use them for other purposes :) I've definitely had to reinvent similar querystring parameter parsing logic for other projects since then.
Josh
Related
IntelliJ IDEA is pretty amazing for Grails development work. It is rather demanding on resources (particularly memory), though, and takes a long while to start up, so occasionally I like to use Visual Studio Code instead for light editing. I'm trying to tune it most effectively for Grails development. Any tips would be most welcome. One thing I'd particularly like to know is if there is some way of setting up a beautifier/formatter for .gsp files.
First of all, you'll have to setup VS Code for java. You can follow this page https://code.visualstudio.com/docs/languages/java
Then, you'll have to install of the groovy language extension. Currently there are three such extensions in the library. code-groovy has more active users than the others and it provides good gsp support. I do use VS code for quick editing or just viewing source code occasionally but its still not the replacement of Intellij. I can't use VS Code for hardcore java/grails development yet.
I am using Visual Studio 2010 with Resharper plugin and my web application is heavy on JavaScript.
By that I mean there is a lot of libraries (knockout.js, jQuery, jQuery UI - to name a few).
While intellisense works alright in C#, I'm having a hard time to start it working for JavaScript. I've tried googling and going through options, preferences and docs all through out the holidays, but seems that I'm searching for something that just isn't there.
So by example there's a class in knockout.js "ko.utils", which has methods like "ko.utils.arrayMap". My question is, how can I make intellisense (of either R# or VS) index this class and offer me methods when I type "ko.utils.", hence speeding up my development in JavaScript?
Note: Possible to get custom javascript files to have intellisense in VS 2010? this is not a duplicate I think, because it is seldom for these libraries to have a special VSDoc script here and if they had one, I still couldn't refere it globally.
You can create a ReSharper plugin to extend the code completion mechanism to provide the features you need. What you'd have to do is analyze the parsed structures yourself, derive the relevant content to be added to completion lists, and inject it when necessary.
Ok, before I begin I realize that there is a lot of documentation on this subject but I have thus far failed to get even basic colourization working for VS2010.
My goal is to simply get to a point where I can open a document and everything is coloured red, from here I can implement the relevant parsing logic.
Here's what I have tried/found:
1) Downloaded all the relevent SDK's and such- Found the ook sample (http://code.msdn.microsoft.com/ookLanguage) - didn't build, didn't work.
2) Knowing almost nothing about MEF read through "Implementing a Language Service By Using the Managed Package Framework" - http://msdn.microsoft.com/en-us/library/bb166533(v=VS.100).aspx
This was pretty much a copy and paste of all the basic stuff here, and also updating some references which were out of date with the sample see: http://social.msdn.microsoft.com/Forums/en-US/vsx/thread/a310fe67-afd2-4592-b295-3fc86fec7996
Now, I have got to a point where when running the package MEF appears to have hooked up correctly (I know this because with the debugger open I can see that the packages initialize and FDoIdle methods are being hit).
When I open a file of the extension I have registered with the ProvideLanguageExtensionAttribute everything dies as if in an endless loop, yet no debug symbols hit (though they are loaded).
Looking at the ook sample and the MEF examples they seem to be totally different approaches to the same problem. In the ook sample there are notions of Clasifications and Completion controllers which aren't mentioned in the MEF example. Also, they don't seem to create a Package or Language service, so I have no idea how it should work?
With the MEF example, my assumption is that I need to hook into the "IScanner.ScanTokenAndProvideInfoAboutIt" to provide syntax highlighting? Which would be fine if I could ever hit this method.
So my first question I guess is which approach should I be taking here? Or do they both somehow tie together?
My second questions is, where can I find a basic fully working project that implements bog standard basic syntax highlighting and intellisense or VS2010?
Thirdly, in the MEF example when I created a Package there were a bunch of test projects created for me. I appears that the integration tests launch the VS2010 test rig somehow, but the test fails. It would be good to write my service with tests but I have no idea what/how I can test each interaction so any references to testing Language services would be helpful.
Finally, please throw any resource/book links my way that I may find useful.
Cheers, Chris.
N.B. Sorry I realize this is part question part rant, but I have never been so confused.
First, the package example is not using MEF. Essentially everyplace that you mention MEF in your question is not actually MEF, but the managed package framework (MPF), also colloquially called the managed language service (MLS). You'd know if your extension was using MEF by two things: the vsixmanifest lists your assembly as containing a MEF component, and you see [Export] and [Import] attributes in the code.
The easiest way to do this is to use MEF. Since you have the SDK installed, you also have a template for an editor classifier project (under C# (or VB)->Extensibility->Editor classifier in the New Project dialog). You can certainly do this with a language service/colorizer/package, but there will be significantly more code than the equivalent classifier.
The Ook solution is the sample for this and should work; if it doesn't build/work, then can you send me email (noahric at microsoft) with what errors you are seeing so I can email the owner of that sample?
In general, you should also read my answer for the question on "How can I write a plugin for VS2010 using MEF?". That has links to other resources that should help.
is there any vs addins that can take a class and set up all the wiring to generate the test class and methods as well as mocking the dependencies, etc. this seems like something that can be automated.
You can try to create some VS templates.
I've create some Resharper templates for mysel but they are as sophisticated as what you want.
Microsoft tried something like that awhile back, I believe, and was widely criticized for not understanding what Test-Driven Development/Design was all about.
Pex might be part of what you're looking for. It's an aid to unit testing, not a replacement for it.
There are also IoC Container frameworks (and I think mock/isolation frameworks as well) that support auto mocking, which might also help.
As Vadim mentioned, templates and snippets can take care of a lot of the boilerplate code.
I haven't used Pex or auto mocking; I just do what Vadim does.
I suspect not; even if the sigs can be automated, You'll need to provide all the cases; it can't infer what is supposed to equal what, what properties matter, what are the edge cases, etc.
I apologize. This is part rant, part question.
For the rant: Dear MS developers who post MVC projects on CodePlex and dedicate their sites to MVC with TDD: I love to learn from you and thanks for the examples, but not everyone has Pro. I'm sick of not being able to load the test project portion of these things because use Standard, which more than covers most needs [with Nunit]. It's annoying.
Now, for the question. :-)
Is there a tool out there to convert these unit test projects to a proj file Studio Standard can open so I can at least compile and view the code?
--
P.S. Dear Microsoft: Enough with not including unit testing with all versions of Studio already. It's silly. Testing is not just an "enterprise" or "pro" feature.
In most cases, switching between test frameworks is just a case of search/replace. If the csproj doesn't load, just create a new project file and drag the code files in and fix them afterwards (along with the references). TestDriven.NET, for example (or NUnit console) are perfectly happy with just a dll/exe as the test project.
Maybe a pain, but not necessarily a huge problem.
If you want to use NUnit with MVC, there are brief instructions here and here - I don't know (haven't tested) whether they apply to Standard.