Permalink
Browse files

Merge pull request #5 from pcibraro/master

Updated to the latest asp.net web api release
  • Loading branch information...
JakeGinnivan committed Dec 15, 2012
2 parents 6a1f5ed + 488e7c2 commit 295e04267c0621bedb246fe2e9215b1e7f3fbf9d
@@ -28,13 +28,13 @@ public void organisation_list_get_xml_test()
{
// arrange
var mediaFormatter = new XmlHalMediaTypeFormatter();
- var contentHeaders = new StringContent(string.Empty).Headers;
+ var content = new StringContent(string.Empty);
var type = representation.GetType();
// act
using (var stream = new MemoryStream())
{
- mediaFormatter.WriteToStream(type, representation, stream, contentHeaders);
+ mediaFormatter.WriteToStream(type, representation, stream, content);
stream.Seek(0, SeekOrigin.Begin);
var serialisedResult = new StreamReader(stream).ReadToEnd();
@@ -49,13 +49,13 @@ public void organisation_list_get_json_test()
{
// arrange
var mediaFormatter = new JsonHalMediaTypeFormatter { Indent = true };
- var contentHeaders = new StringContent(string.Empty).Headers;
+ var content = new StringContent(string.Empty);
var type = representation.GetType();
// act
using (var stream = new MemoryStream())
{
- mediaFormatter.WriteToStreamAsync(type, representation, stream, contentHeaders, null).Wait();
+ mediaFormatter.WriteToStreamAsync(type, representation, stream, content, null).Wait();
stream.Seek(0, SeekOrigin.Begin);
var serialisedResult = new StreamReader(stream).ReadToEnd();
@@ -22,13 +22,13 @@ public void organisation_get_json_test()
{
// arrange
var mediaFormatter = new JsonHalMediaTypeFormatter { Indent = true };
- var contentHeaders = new StringContent(string.Empty).Headers;
+ var content = new StringContent(string.Empty);
var type = resource.GetType();
// act
using (var stream = new MemoryStream())
{
- mediaFormatter.WriteToStreamAsync(type, resource, stream, contentHeaders, null);
+ mediaFormatter.WriteToStreamAsync(type, resource, stream, content, null);
stream.Seek(0, SeekOrigin.Begin);
var serialisedResult = new StreamReader(stream).ReadToEnd();
@@ -43,13 +43,13 @@ public void organisation_get_xml_test()
{
// arrange
var mediaFormatter = new XmlHalMediaTypeFormatter();
- var contentHeaders = new StringContent(string.Empty).Headers;
+ var content = new StringContent(string.Empty);
var type = resource.GetType();
// act
using (var stream = new MemoryStream())
{
- mediaFormatter.WriteToStreamAsync(type, resource, stream, contentHeaders, null);
+ mediaFormatter.WriteToStreamAsync(type, resource, stream, content, null);
stream.Seek(0, SeekOrigin.Begin);
var serialisedResult = new StreamReader(stream).ReadToEnd();
@@ -22,13 +22,13 @@ public void organisation_get_json_test()
{
// arrange
var mediaFormatter = new JsonHalMediaTypeFormatter { Indent = true };
- var contentHeaders = new StringContent(string.Empty).Headers;
+ var content = new StringContent(string.Empty);
var type = resource.GetType();
// act
using (var stream = new MemoryStream())
{
- mediaFormatter.WriteToStreamAsync(type, resource, stream, contentHeaders, null).Wait();
+ mediaFormatter.WriteToStreamAsync(type, resource, stream, content, null).Wait();
stream.Seek(0, SeekOrigin.Begin);
var serialisedResult = new StreamReader(stream).ReadToEnd();
@@ -43,13 +43,13 @@ public void organisation_get_xml_test()
{
// arrange
var mediaFormatter = new XmlHalMediaTypeFormatter();
- var contentHeaders = new StringContent(string.Empty).Headers;
+ var content = new StringContent(string.Empty);
var type = resource.GetType();
// act
using (var stream = new MemoryStream())
{
- mediaFormatter.WriteToStreamAsync(type, resource, stream, contentHeaders, null);
+ mediaFormatter.WriteToStreamAsync(type, resource, stream, content, null);
stream.Seek(0, SeekOrigin.Begin);
var serialisedResult = new StreamReader(stream).ReadToEnd();
@@ -32,14 +32,25 @@
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
- <Reference Include="Newtonsoft.Json">
- <HintPath>..\packages\Newtonsoft.Json.4.5.7\lib\net40\Newtonsoft.Json.dll</HintPath>
+ <Reference Include="Newtonsoft.Json, Version=4.5.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
+ <SpecificVersion>False</SpecificVersion>
+ <HintPath>..\packages\Newtonsoft.Json.4.5.11\lib\net40\Newtonsoft.Json.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.Core" />
- <Reference Include="System.Net.Http, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL" />
- <Reference Include="System.Net.Http.Formatting, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL" />
+ <Reference Include="System.Net.Http, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
+ <HintPath>..\packages\Microsoft.Net.Http.2.0.20710.0\lib\net40\System.Net.Http.dll</HintPath>
+ </Reference>
+ <Reference Include="System.Net.Http.Formatting, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
+ <HintPath>..\packages\Microsoft.AspNet.WebApi.Client.4.0.20710.0\lib\net40\System.Net.Http.Formatting.dll</HintPath>
+ </Reference>
+ <Reference Include="System.Net.Http.WebRequest, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
+ <HintPath>..\packages\Microsoft.Net.Http.2.0.20710.0\lib\net40\System.Net.Http.WebRequest.dll</HintPath>
+ </Reference>
<Reference Include="System.Web" />
+ <Reference Include="System.Web.Http, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
+ <HintPath>..\packages\Microsoft.AspNet.WebApi.Core.4.0.20710.0\lib\net40\System.Web.Http.dll</HintPath>
+ </Reference>
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="Microsoft.CSharp" />
@@ -3,6 +3,7 @@
using System.Collections.Generic;
using System.IO;
using System.Linq;
+using System.Net.Http;
using System.Net.Http.Formatting;
using System.Net.Http.Headers;
using System.Reflection;
@@ -19,7 +20,7 @@ public XmlHalMediaTypeFormatter()
SupportedMediaTypes.Add(new MediaTypeHeaderValue("application/hal+xml"));
}
- public override object ReadFromStream(Type type, Stream stream, HttpContentHeaders contentHeaders, IFormatterLogger formatterLogger)
+ public override object ReadFromStream(Type type, Stream stream, HttpContent content, IFormatterLogger formatterLogger)
{
if (!typeof(Representation).IsAssignableFrom(type))
{
@@ -30,7 +31,7 @@ public override object ReadFromStream(Type type, Stream stream, HttpContentHeade
return ReadHalResource(type, xml);
}
- public override void WriteToStream(Type type, object value, Stream stream, HttpContentHeaders contentHeaders)
+ public override void WriteToStream(Type type, object value, Stream stream, HttpContent content)
{
var resource = value as Representation;
if (resource == null)
@@ -1,4 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
- <package id="Newtonsoft.Json" version="4.5.7" />
+ <package id="Microsoft.AspNet.WebApi.Client" version="4.0.20710.0" targetFramework="net40" />
+ <package id="Microsoft.AspNet.WebApi.Core" version="4.0.20710.0" targetFramework="net40" />
+ <package id="Microsoft.Net.Http" version="2.0.20710.0" targetFramework="net40" />
+ <package id="Newtonsoft.Json" version="4.5.11" targetFramework="net40" />
</packages>

0 comments on commit 295e042

Please sign in to comment.