From 13adde63fa2bf2c8b8ec8c253a5a9c18d01a1156 Mon Sep 17 00:00:00 2001 From: Wei Wang Date: Wed, 10 Sep 2014 09:13:22 -0700 Subject: [PATCH] Update the method used to read JSON asynchronously --- .../Google/GoogleMiddlewareTests.cs | 2 +- .../MicrosoftAccount/MicrosoftAccountMiddlewareTests.cs | 2 +- .../Twitter/TwitterMiddlewareTests.cs | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/test/Microsoft.AspNet.Security.Test/Google/GoogleMiddlewareTests.cs b/test/Microsoft.AspNet.Security.Test/Google/GoogleMiddlewareTests.cs index 9dff1506d5..e12def60fa 100644 --- a/test/Microsoft.AspNet.Security.Test/Google/GoogleMiddlewareTests.cs +++ b/test/Microsoft.AspNet.Security.Test/Google/GoogleMiddlewareTests.cs @@ -424,7 +424,7 @@ namespace Microsoft.AspNet.Security.Google private static async Task ReturnJsonResponse(object content) { var res = new HttpResponseMessage(HttpStatusCode.OK); - var text = await JsonConvert.SerializeObjectAsync(content); + var text = await Task.Factory.StartNew(() => JsonConvert.SerializeObject(content)); res.Content = new StringContent(text, Encoding.UTF8, "application/json"); return res; } diff --git a/test/Microsoft.AspNet.Security.Test/MicrosoftAccount/MicrosoftAccountMiddlewareTests.cs b/test/Microsoft.AspNet.Security.Test/MicrosoftAccount/MicrosoftAccountMiddlewareTests.cs index 2c1da025fd..7bfb0d4491 100644 --- a/test/Microsoft.AspNet.Security.Test/MicrosoftAccount/MicrosoftAccountMiddlewareTests.cs +++ b/test/Microsoft.AspNet.Security.Test/MicrosoftAccount/MicrosoftAccountMiddlewareTests.cs @@ -204,7 +204,7 @@ namespace Microsoft.AspNet.Security.Tests.MicrosoftAccount private static async Task ReturnJsonResponse(object content) { var res = new HttpResponseMessage(HttpStatusCode.OK); - var text = await JsonConvert.SerializeObjectAsync(content); + var text = await Task.Factory.StartNew(() => JsonConvert.SerializeObject(content)); res.Content = new StringContent(text, Encoding.UTF8, "application/json"); return res; } diff --git a/test/Microsoft.AspNet.Security.Test/Twitter/TwitterMiddlewareTests.cs b/test/Microsoft.AspNet.Security.Test/Twitter/TwitterMiddlewareTests.cs index d5eb56896b..75f7ebbfd3 100644 --- a/test/Microsoft.AspNet.Security.Test/Twitter/TwitterMiddlewareTests.cs +++ b/test/Microsoft.AspNet.Security.Test/Twitter/TwitterMiddlewareTests.cs @@ -152,7 +152,7 @@ namespace Microsoft.AspNet.Security.Twitter private static async Task ReturnJsonResponse(object content) { var res = new HttpResponseMessage(HttpStatusCode.OK); - var text = await JsonConvert.SerializeObjectAsync(content); + var text = await Task.Factory.StartNew(() => JsonConvert.SerializeObject(content)); res.Content = new StringContent(text, Encoding.UTF8, "application/json"); return res; }