Where can I find up-to-date documentation about the WCF Web API? - wcf

I've been strugling with WCF to do REST the way I want it to work. And apparently so has quite a few others. I've heard about the WCF Web Api project, but wrongly dismissed it without looking too closely at it. Sadly, now that I'm looking at it I find that the documentation is rather outdated. Like, this blog post has some nice information, but classes have changed, parameters have changed, in short, design has changed.
So I've been using an old example of how to plug in Json.NET (newtonsoft) as my serializier, only to realize that after I had it working, it wouldn't work for my IErrorHandler. Further I had a problem with how to Deserialize a string from the uri template to an operation Type parameter.
It appears however that I should be able to solve these two problems (and presumably many others that I haven't stumbled over yet) by using the media formatter extension point and what's referred to as Processor<..>s in outdated documentation, which is now HttpOperationHandler<..>s unless I've missunderstood.
My problem is rather basic, I can't figure out how to correctly configure my IIS-hosted app to use my operation handler, assuming I've implemented it correctly. Since it feels rather dumb to ask for instructions on such a basic thing, I'll rather ask where I can find some documentation on how to do this sort of thing? (Explanations are welcome of course.)
I'm not after seing which classes exist, or what their methods are named with what parameters. I can see all that in my object browser. I need documentation for the overall design, and/or examples implicitly describing things like:
How do the different classes in the API fit together?
How can I configure from web.config?
Must I rather do a custom HttpServiceHostFactory?
What and how are you meant to use the framework?
How should I extend to reach what sort of goals?
How should I configure to place the extensions in effect?

From the lack of answers I assume the documentation quite simply isn't ready.
I was looking for it on the codeplex site under the Documentation tab, and found outdated stuff.
However, after familiarizing myself a bit with Codeplex I found out that the good stuff was in this Discussion section. Searching a bit in there helped a lot to be honest.
Concerning config-file configuration, I didn't find anything, so I'm assuming this will be added as the last thing before official release. Meaning I'll use the HttpConfiguration in a custom HttpServiceHostFactory for now.
The trick about the HttpOperationHandlers was twofold: Firstly I was throwing an exception in my operation and hadn't implemented a global HttpErrorHandler yet. (Doh!) Secondly I didn't know that the parameter name of HttpOperationHandler<..>.OnHandle had to match the name of the operation parameter.

Related

System.Web has been removed in ASP.NET 5, so how do I find the new places?

So I jsut managed to deploya very basic MVC site on Ubuntu, behind nginx served by kestrel. Fantastic.
Now I just wanted to do a simple thing like show the visitors reported IP address, just for fun. You know, I want it to lead up to SQL/MySql get the whole feature set going on within Ubuntu.
But System.Web was removed from aspnet50 and broken down and you cannot just access System.Web.HttpContext... or Reaquest.UserHostAddress()
I can see #Request but I doesnt have all the properties I would be expecting.
How do I find... or am I supposed to find which dependency to add which contains that feature or any other feature I might be looking for from the full .NET 4.5 MVC?
To quickly find out which package might contain a type you're looking for, check out the totally unofficial Reverse Package Search. Just type in something like IPAddress and you'll get a list of packages that are good hints.
It's of course not 100% reliable, but it's better than guessing.
If you have JetBrains' ReSharper, it also provides context actions to find a namespace or a type on NuGet:
http://www.jetbrains.com/resharper/help/Finding_Exploring_and_Installing_NuGet_Packages.html

what is swagger exactly ? And why doesn't the online editor run requests?

I've spent the last few days trying to understand if I should use api blueprint, RAML or swagger.
It looks like swagger has the biggest community but the closer I look the more I feel that it greatly lacks in documentation (I was forced to look at the code many times to try and integrate it with my current project), many github issues and stackoverflow questions are unanswered.
Is it possible that I am missing something here?
All I want is a tool to help me write the API documentation and test the endpoints.
Why must swagger become part of the server logic?? If I create swagger files in the editor and then serve them to the UI directly it breaks..
As far as I can tell it even makes the server slightly slower and forces the existence of many clumsily maintained integrations :p What am I missing here?
We're trying to work a lot on improving the documentation of Swagger. It's a bit more difficult when many of the projects are community-driven and not managed by a single organization.
We actually try to reply to issues on github quickly (we don't always succeed) and we have our own google group for general questions so we follow stackoverflow somewhat less.
The editor you mention is a new tool as part of the work on Swagger 2.0 and it's not final yet. As such, it still have a few bugs and missing features. The UI is also in the process of being adapted to Swagger 2.0 and the same limitations apply to it.
You most certainly don't have to integrate it with your server and you can expose the documentation statically. The advantage of integrating it with the server is that it's easier to maintain if the API changes.
You can try RAML + ramlev + Abao
The steps should be
Write API Spec in RAML with your fav editor, ie. Atom, vim
Validate your RAML with ramlev
Implement the server logic according API Spec
Validate server logic with Abao

FluentAssertions - complete tutorial for creating custom assertions

Has anybody seen a complete tutorial for creating custom assertion classes with FluentAssertions?
Best regards
I maintain a couple of extension packages for Fluent Assertions, so feel free to take a look at our code to see how we do it:
FluentAssertions.Mvc
FluentAssertions.Ioc.Ninjet
I also recently contributed the assembly reference assertions to the core, so have a look at this pull request. Also have a look at the FA source to see how they implement similar assertions (that's where we started).
The top line is you'll need a class to hold your assertions and an extension method to hook it in.

How do I create an IMServicePlugin on OS X? No documentation on file structure

Apple has provided good documentation on the protocols for IMServicePlugin.framework, but provides literally zero documentation on how this is compiled, in what format, what keys for the services plist are what, etc. Has anyone had experience with this? If so, are you aware of any documentation on the subject?
Apple has a sample plugin that implements IRC, you can find it here. I know that it says that it's legacy, but that's the only sample code you'll find I'm afraid.
If you want to build one from scratch, it's actually quite "simple": In Xcode, create a new project and select Bundle, link against the IMServicePlugIn.framework and make sure that your Principal Class conforms to the IMServicePlugIn. Then, well, do whatever you need to do. When in doubt about anything, the documentation is pretty extensive (but it seems like you've already found out about that).

Is mocking functionality available for Microsoft Fakes?

With the inclusion of Microsoft Fakes in Visual Studio 11, I thought it would be worth to look into again, since I did not find Moles mature enough last i checked. The documentation is still sparse, but I cannot find any reference to mocks, i.e. the ability to set up and verify expectations on the faked objects.
Does anyone know if this is currently included (as a feature in the library) or will be?
It is not included currently, but we are considering something in this area.
Although they are not included, you can use stubs to hack in the same behavior. In your stub you can capture whether the method was called and the parameters that were called. Of course, by the time you start doing that you're almost hand rolling your own mocks.
In the meantime I'd suggest Moq or RhinoMocks. I find the syntax simpler and I'm not a fan of the generated code that Microsoft Fakes uses anyhow. Try renaming a method on one of your fakes using a refactoring tool. It's not possible because your fake is a generated class, not an instance of the interface you are stubbing.