Skip to content

Commit

Permalink
system.text.json: update azure devops tests
Browse files Browse the repository at this point in the history
Update Azure DevOps API tests to use System.Text.Json rather than
Json.NET for JSON serialization.
  • Loading branch information
ldennington committed Jun 5, 2023
1 parent 71d03fb commit 2e153ce
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions src/shared/Microsoft.AzureRepos.Tests/AzureDevOpsApiTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@
using System.Net;
using System.Net.Http;
using System.Net.Http.Headers;
using System.Text.Json;
using System.Threading.Tasks;
using GitCredentialManager;
using GitCredentialManager.Tests.Objects;
using Newtonsoft.Json;
using Xunit;

namespace Microsoft.AzureRepos.Tests
Expand Down Expand Up @@ -411,9 +411,10 @@ private static void AssertBearerToken(HttpRequestMessage request, string bearerT

private static HttpResponseMessage CreateLocationServiceResponse(Uri identityServiceUri)
{
var json = JsonConvert.SerializeObject(
new Dictionary<string, object>{["location"] = identityServiceUri.AbsoluteUri}
);
var json = JsonSerializer.Serialize(new Dictionary<string, object>
{
["location"] = identityServiceUri.AbsoluteUri
});

return new HttpResponseMessage(HttpStatusCode.OK)
{
Expand All @@ -423,7 +424,7 @@ private static HttpResponseMessage CreateLocationServiceResponse(Uri identitySer

private static HttpResponseMessage CreateIdentityServiceResponse(string pat)
{
var json = JsonConvert.SerializeObject(
var json = JsonSerializer.Serialize(
new Dictionary<string, object> {["token"] = pat}
);

Expand All @@ -435,7 +436,7 @@ private static HttpResponseMessage CreateIdentityServiceResponse(string pat)

private static HttpResponseMessage CreateIdentityServiceErrorResponse(string errorMessage)
{
var json = JsonConvert.SerializeObject(
var json = JsonSerializer.Serialize(
new Dictionary<string, object> {["message"] = errorMessage}
);

Expand Down

0 comments on commit 2e153ce

Please sign in to comment.