If you have been trying to follow the tutorial on Outside in TDD by Mark Seemann but don’t have access to the source code, then you will have probably come across certain issues.
Here I will detail what I did differently to him and also how to overcome some of the issues.
In the videos, the author makes use of the “microsoft.net.http” dlls but I believe that libraries are now available in “System.Net.Http”. However, if you decide to choose the latter, you might come unstuck while using the HttpClientFactory as the latter is part of “System.Net.Http”. I didn’t delve into it as I’m sure it provides a way to create the client and so I simply created a “MyHttpClientFactory” to get round this issue.
This method is part of System.Threading.Tasks.
This is one of the tests that he uses and at some point he comes up with code as follows:
At this point you get two problems:
The second issue is “easy” to deal with because from the video you can see a class called “ContentReader.cs”. The latter so happens to be available here:
part of which is reproduced below for your convenience:
The first issue was slightly harder to figure out because I am not familiar enough with Json.NET but eventually using the code in GitHub as given above, it was possible to resolve the issue. Hence the code is now:
You could of course tidy up the code in order to create that method “ToJObject” but I will leave that to the reader to do this.
The “Claim” class is part of System.Security.Claims but that namespace is only available as from .NET 4.5.
You will need to reference System.Net.Formatting in order to get this working (http://stackoverflow.com/questions/10399324/where-is-httpcontent-readasasync).