-
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add support for system.text.json
update to .NET 6.0
- Loading branch information
Showing
49 changed files
with
966 additions
and
222 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
src/Speedygeek.ZendeskAPI.IntegrationTests/Speedygeek.ZendeskAPI.IntegrationTests.csproj
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -40,21 +40,21 @@ public void ApiTokenAuthApiTokenNull() | |
[Test] | ||
public void ApiTokenAuthNullClient() | ||
{ | ||
Assert.That(() => { new APITokenCredentials(Settings.AdminUserName, Settings.ApiToken).ConfigureHttpClientAsync(null).ConfigureAwait(false); }, | ||
Assert.That(() => { new APITokenCredentials(Settings.AdminUserName, Settings.ApiToken).ConfigureHttpClient(null); }, | ||
Throws.ArgumentNullException); | ||
} | ||
|
||
[Test] | ||
public void OAuthTokenAuthNullClient() | ||
{ | ||
Assert.That(() => { new OAuthAccessTokenCredentials(Settings.AdminOAuthToken).ConfigureHttpClientAsync(null).ConfigureAwait(false); }, | ||
Assert.That(() => { new OAuthAccessTokenCredentials(Settings.AdminOAuthToken).ConfigureHttpClient(null); }, | ||
Throws.ArgumentNullException); | ||
} | ||
|
||
[Test] | ||
public void BasicAuthNullClient() | ||
{ | ||
Assert.That(() => { new BasicCredentials(Settings.AdminUserName, Settings.AdminPassword).ConfigureHttpClientAsync(null).ConfigureAwait(false); }, | ||
Assert.That(() => { new BasicCredentials(Settings.AdminUserName, Settings.AdminPassword).ConfigureHttpClient(null); }, | ||
Throws.ArgumentNullException); | ||
} | ||
|
||
|
@@ -80,12 +80,12 @@ public void OAuthTokenAuthNullEndUserId() | |
} | ||
|
||
[Test] | ||
public async Task ApiTokenAuthBuildHeader() | ||
public void ApiTokenAuthBuildHeader() | ||
{ | ||
using var client = new HttpClient(); | ||
var cred = new APITokenCredentials(Settings.AdminUserName, Settings.ApiToken); | ||
|
||
await cred.ConfigureHttpClientAsync(client).ConfigureAwait(false); | ||
cred.ConfigureHttpClient(client); | ||
|
||
var headerScheme = client.DefaultRequestHeaders.Authorization.Scheme; | ||
var headerParameter = client.DefaultRequestHeaders.Authorization.Parameter; | ||
|
@@ -95,12 +95,12 @@ public async Task ApiTokenAuthBuildHeader() | |
} | ||
|
||
[Test] | ||
public async Task BasicAuthBuildHeader() | ||
public void BasicAuthBuildHeader() | ||
{ | ||
using var client = new HttpClient(); | ||
var cred = new BasicCredentials(Settings.AdminUserName, Settings.AdminPassword); | ||
|
||
await cred.ConfigureHttpClientAsync(client).ConfigureAwait(false); | ||
cred.ConfigureHttpClient(client); | ||
|
||
var headerScheme = client.DefaultRequestHeaders.Authorization.Scheme; | ||
var headerParameter = client.DefaultRequestHeaders.Authorization.Parameter; | ||
|
@@ -110,13 +110,13 @@ public async Task BasicAuthBuildHeader() | |
} | ||
|
||
[Test] | ||
public async Task OAuthOnBehalfOfAuthBuildHeader() | ||
public void OAuthOnBehalfOfAuthBuildHeader() | ||
{ | ||
using var client = new HttpClient(); | ||
var endUserId = "[email protected]"; | ||
var cred = new OAuthAccessTokenCredentials(Settings.AdminOAuthToken, endUserId); | ||
|
||
await cred.ConfigureHttpClientAsync(client).ConfigureAwait(false); | ||
cred.ConfigureHttpClient(client); | ||
|
||
var headerValue = client.DefaultRequestHeaders.GetValues("X-On-Behalf-Of").FirstOrDefault(); | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,7 +6,7 @@ | |
using Speedygeek.ZendeskAPI.Serialization; | ||
|
||
|
||
namespace Speedygeek.ZendeskAPI.UnitTests | ||
namespace Speedygeek.ZendeskAPI.UnitTests.Serialization | ||
{ | ||
[TestFixture] | ||
public class CollaboratorConverterTest | ||
|
@@ -25,20 +25,20 @@ public void SetUp() | |
[Test] | ||
public void ConvertMixedTypes() | ||
{ | ||
var json = @"{ ""Ticket"": { ""id"": 1002, ""collaborators"": [ 562562562, ""[email protected]"", { ""name"": ""Someone Else"", ""email"": ""[email protected]"" } ]}}"; | ||
var json = @"{ ""id"": 1002, ""collaborators"": [ 562562562, ""[email protected]"", { ""name"": ""Someone Else"", ""email"": ""[email protected]"" } ]}"; | ||
|
||
TicketResponse resp = null; | ||
using (var stream = new MemoryStream(Encoding.ASCII.GetBytes(json))) | ||
Ticket resp = null; | ||
using (var stream = new MemoryStream(Encoding.UTF8.GetBytes(json))) | ||
{ | ||
resp = _serializer.Deserialize<TicketResponse>(stream); | ||
resp = _serializer.Deserialize<Ticket>(stream); | ||
} | ||
|
||
Assert.That(resp.Ticket, Is.Not.Null); | ||
Assert.That(resp.Ticket.Collaborators[0].Id, Is.Not.Zero); | ||
Assert.That(resp.Ticket.Collaborators[1].Email, Is.EqualTo("[email protected]")); | ||
Assert.That(resp, Is.Not.Null); | ||
Assert.That(resp.Collaborators[0].Id, Is.Not.Zero); | ||
Assert.That(resp.Collaborators[1].Email, Is.EqualTo("[email protected]")); | ||
|
||
Assert.That(resp.Ticket.Collaborators[2].Email, Is.EqualTo("[email protected]")); | ||
Assert.That(resp.Ticket.Collaborators[2].Name, Is.EqualTo("Someone Else")); | ||
Assert.That(resp.Collaborators[2].Email, Is.EqualTo("[email protected]")); | ||
Assert.That(resp.Collaborators[2].Name, Is.EqualTo("Someone Else")); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.