Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .config/dotnet-tools.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
"rollForward": false
},
"nbgv": {
"version": "3.7.112",
"version": "3.7.115",
"commands": [
"nbgv"
],
Expand Down
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm
## [0.12] - unplanned
### Removed
- .NET 6.0 target, since it is no longer supported
- .NET Framework 4.6.2, 4.7.0 and 4.7.2, since these can't be tested using xUnit v3
### Added
- Support for .NET 9.0

Expand Down
3 changes: 1 addition & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -81,8 +81,7 @@ The options include:
TestableHttpClient is build as a netstandard2.0 library, so theoretically it can work on every .NET version that support netstandard2.0.
The following versions are being actively tested and thus supported:

- .NET Framework 4.6, 4.7 and 4.8
- .NET 6.0
- .NET Framework 4.7.2 and 4.8
- .NET 8.0
- .NET 9.0

Expand Down
4 changes: 2 additions & 2 deletions test/Directory.Build.targets
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
<Project>
<ItemGroup>
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.12.0" />
<PackageReference Include="xunit" Version="2.9.3" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.8.2">
<PackageReference Include="xunit.v3" Version="1.0.1" />
<PackageReference Include="xunit.runner.visualstudio" Version="3.0.1">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
Expand Down
26 changes: 13 additions & 13 deletions test/TestableHttpClient.IntegrationTests/AssertingRequests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ public async Task WhenAssertingCallsAreNotMade_AndCallsWereMade_AssertionExcepti
using TestableHttpMessageHandler testHandler = new();
using HttpClient client = new(testHandler);

_ = await client.GetAsync("https://httpbin.org/get");
_ = await client.GetAsync("https://httpbin.org/get", TestContext.Current.CancellationToken);

testHandler.ShouldHaveMadeRequests();
Assert.Throws<HttpRequestMessageAssertionException>(() => testHandler.ShouldHaveMadeRequests(0));
Expand All @@ -30,7 +30,7 @@ public async Task AssertingCallsAreNotMadeToSpecificUri()
using TestableHttpMessageHandler testHandler = new();
using HttpClient client = new(testHandler);

_ = await client.GetAsync("https://httpbin.org/get");
_ = await client.GetAsync("https://httpbin.org/get", TestContext.Current.CancellationToken);

testHandler.ShouldHaveMadeRequestsTo("https://example.org", 0);
Assert.Throws<HttpRequestMessageAssertionException>(() => testHandler.ShouldHaveMadeRequestsTo("https://httpbin.org/get", 0));
Expand All @@ -42,7 +42,7 @@ public async Task AssertingCallsAreMadeToSpecificUriPattern()
using TestableHttpMessageHandler testHandler = new();
using HttpClient client = new(testHandler);

_ = await client.GetAsync("https://httpbin.org/get");
_ = await client.GetAsync("https://httpbin.org/get", TestContext.Current.CancellationToken);

testHandler.ShouldHaveMadeRequestsTo("https://*");
testHandler.ShouldHaveMadeRequestsTo("https://*.org/get");
Expand All @@ -61,7 +61,7 @@ public async Task AssertingCallsUsingUriPattern()
using TestableHttpMessageHandler testHandler = new();
using HttpClient client = new(testHandler);

_ = await client.GetAsync("https://httpbin.org/get");
_ = await client.GetAsync("https://httpbin.org/get", TestContext.Current.CancellationToken);

testHandler.ShouldHaveMadeRequests().WithRequestUri("https://*");
testHandler.ShouldHaveMadeRequests().WithRequestUri("https://*.org/get");
Expand All @@ -80,7 +80,7 @@ public async Task ChainUriPatternAssertions()
using TestableHttpMessageHandler testHandler = new();
using HttpClient client = new(testHandler);

_ = await client.GetAsync("https://httpbin.org/get");
_ = await client.GetAsync("https://httpbin.org/get", TestContext.Current.CancellationToken);

testHandler.ShouldHaveMadeRequestsTo("https://*")
.WithRequestUri("*://httpbin.org/*")
Expand All @@ -93,7 +93,7 @@ public async Task AssertingCallWithQueryParameters()
using TestableHttpMessageHandler testHandler = new();
using HttpClient client = new(testHandler);

_ = await client.GetAsync("https://httpbin.org/get?email=admin@example.com");
_ = await client.GetAsync("https://httpbin.org/get?email=admin@example.com", TestContext.Current.CancellationToken);

testHandler.ShouldHaveMadeRequests().WithRequestUri("?email=admin@example.com");
testHandler.ShouldHaveMadeRequests().WithRequestUri("?email=*");
Expand All @@ -106,9 +106,9 @@ public async Task AssertingHttpMethods()
using TestableHttpMessageHandler testHandler = new();
using HttpClient client = new(testHandler);

_ = await client.GetAsync("https://httpbin.org/get");
_ = await client.GetAsync("https://httpbin.org/get", TestContext.Current.CancellationToken);
using StringContent content = new("");
_ = await client.PostAsync("https://httpbin.org/post", content);
_ = await client.PostAsync("https://httpbin.org/post", content, TestContext.Current.CancellationToken);

testHandler.ShouldHaveMadeRequestsTo("*/get").WithHttpMethod(HttpMethod.Get);
Assert.Throws<HttpRequestMessageAssertionException>(() => testHandler.ShouldHaveMadeRequestsTo("*/get").WithHttpMethod(HttpMethod.Post));
Expand All @@ -122,7 +122,7 @@ public async Task AssertingRequestHeaders()
using TestableHttpMessageHandler testHandler = new();
using HttpClient client = new(testHandler);
client.DefaultRequestHeaders.Add("api-version", "1.0");
_ = await client.GetAsync("https://httpbin.org/get");
_ = await client.GetAsync("https://httpbin.org/get", TestContext.Current.CancellationToken);

testHandler.ShouldHaveMadeRequests().WithRequestHeader("api-version");
testHandler.ShouldHaveMadeRequests().WithRequestHeader("api-version", "1.0");
Expand All @@ -140,7 +140,7 @@ public async Task AssertingContentHeaders()
using HttpClient client = new(testHandler);

using StringContent content = new("", Encoding.UTF8, "application/json");
_ = await client.PostAsync("https://httpbin.org/post", content);
_ = await client.PostAsync("https://httpbin.org/post", content, TestContext.Current.CancellationToken);

testHandler.ShouldHaveMadeRequests().WithContentHeader("content-type");
testHandler.ShouldHaveMadeRequests().WithContentHeader("Content-Type");
Expand All @@ -160,7 +160,7 @@ public async Task AssertingContent()
using HttpClient client = new(testHandler);

using StringContent content = new("my special content");
_ = await client.PostAsync("https://httpbin.org/post", content);
_ = await client.PostAsync("https://httpbin.org/post", content, TestContext.Current.CancellationToken);

#if NETFRAMEWORK
// On .NET Framework the HttpClient disposes the content automatically. So we can't perform the same test.
Expand All @@ -182,7 +182,7 @@ public async Task AssertJsonContent()
using HttpClient client = new(testHandler);

using StringContent content = new("{}", Encoding.UTF8, "application/json");
_ = await client.PostAsync("https://httpbin.org/post", content);
_ = await client.PostAsync("https://httpbin.org/post", content, TestContext.Current.CancellationToken);

#if NETFRAMEWORK
// On .NET Framework the HttpClient disposes the content automatically. So we can't perform the same test.
Expand All @@ -199,7 +199,7 @@ public async Task CustomAssertions()
using HttpClient client = new(testHandler);

using StringContent content = new("", Encoding.UTF8, "application/json");
_ = await client.PostAsync("https://httpbin.org/post", content);
_ = await client.PostAsync("https://httpbin.org/post", content, TestContext.Current.CancellationToken);

testHandler.ShouldHaveMadeRequests().WithFilter(x => x.Content is not null && x.Content.Headers.ContentType?.MediaType == "application/json", "");
}
Expand Down
46 changes: 23 additions & 23 deletions test/TestableHttpClient.IntegrationTests/ConfigureResponses.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,10 @@ public async Task UsingTestHandler_WithoutSettingUpResponse_Returns200OKWithoutC
using TestableHttpMessageHandler testHandler = new();

using HttpClient httpClient = new(testHandler);
HttpResponseMessage result = await httpClient.GetAsync("http://httpbin.org/status/200");
HttpResponseMessage result = await httpClient.GetAsync("http://httpbin.org/status/200", TestContext.Current.CancellationToken);

Assert.Equal(HttpStatusCode.OK, result.StatusCode);
Assert.Equal(string.Empty, await result.Content.ReadAsStringAsync());
Assert.Equal(string.Empty, await result.Content.ReadAsStringAsync(TestContext.Current.CancellationToken));
}

[Fact]
Expand All @@ -23,10 +23,10 @@ public async Task UsingTestHandlerWithCustomResponse_ReturnsCustomResponse()
testHandler.RespondWith(Text("HttpClient testing is easy"));

using HttpClient httpClient = new(testHandler);
HttpResponseMessage result = await httpClient.GetAsync("http://httpbin.org/status/200");
HttpResponseMessage result = await httpClient.GetAsync("http://httpbin.org/status/200", TestContext.Current.CancellationToken);

Assert.Equal(HttpStatusCode.OK, result.StatusCode);
Assert.Equal("HttpClient testing is easy", await result.Content.ReadAsStringAsync());
Assert.Equal("HttpClient testing is easy", await result.Content.ReadAsStringAsync(TestContext.Current.CancellationToken));
}

[Fact]
Expand All @@ -37,10 +37,10 @@ public async Task UsingTestHandlerWithMultipleCustomResponse_ReturnsLastCustomRe
testHandler.RespondWith(Json("Not Found", HttpStatusCode.NotFound));

using HttpClient httpClient = new(testHandler);
HttpResponseMessage result = await httpClient.GetAsync("http://httpbin.org/status/201");
HttpResponseMessage result = await httpClient.GetAsync("http://httpbin.org/status/201", TestContext.Current.CancellationToken);

Assert.Equal(HttpStatusCode.NotFound, result.StatusCode);
Assert.Equal("\"Not Found\"", await result.Content.ReadAsStringAsync());
Assert.Equal("\"Not Found\"", await result.Content.ReadAsStringAsync(TestContext.Current.CancellationToken));
}

[Fact]
Expand All @@ -60,10 +60,10 @@ public async Task UsingTestHandlerWithCustomResponse_AlwaysReturnsSameCustomResp

foreach (string? url in urls)
{
HttpResponseMessage result = await httpClient.GetAsync(url);
HttpResponseMessage result = await httpClient.GetAsync(url, TestContext.Current.CancellationToken);

Assert.Equal(HttpStatusCode.OK, result.StatusCode);
Assert.Equal("HttpClient testing is easy", await result.Content.ReadAsStringAsync());
Assert.Equal("HttpClient testing is easy", await result.Content.ReadAsStringAsync(TestContext.Current.CancellationToken));
}
}

Expand All @@ -85,13 +85,13 @@ static IResponse PathBasedResponse(HttpResponseContext context)
testHandler.RespondWith(SelectResponse(PathBasedResponse));

using HttpClient httpClient = new(testHandler);
HttpResponseMessage response = await httpClient.GetAsync("http://httpbin/status/200");
HttpResponseMessage response = await httpClient.GetAsync("http://httpbin/status/200", TestContext.Current.CancellationToken);
Assert.Equal(HttpStatusCode.OK, response.StatusCode);

response = await httpClient.GetAsync("http://httpbin.org/status/400");
response = await httpClient.GetAsync("http://httpbin.org/status/400", TestContext.Current.CancellationToken);
Assert.Equal(HttpStatusCode.BadRequest, response.StatusCode);

response = await httpClient.GetAsync("http://httpbin.org/status/500");
response = await httpClient.GetAsync("http://httpbin.org/status/500", TestContext.Current.CancellationToken);
Assert.Equal(HttpStatusCode.NotFound, response.StatusCode);
}

Expand All @@ -108,16 +108,16 @@ public async Task UsingTestHandlerWithRoute_AllowsForRoutingUseCases()
}));

using HttpClient httpClient = new(testHandler);
HttpResponseMessage response = await httpClient.GetAsync("http://httpbin/status/200");
HttpResponseMessage response = await httpClient.GetAsync("http://httpbin/status/200", TestContext.Current.CancellationToken);
Assert.Equal(HttpStatusCode.Redirect, response.StatusCode);

response = await httpClient.GetAsync("https://httpbin/status/200");
response = await httpClient.GetAsync("https://httpbin/status/200", TestContext.Current.CancellationToken);
Assert.Equal(HttpStatusCode.OK, response.StatusCode);

response = await httpClient.GetAsync("https://httpbin.org/status/400");
response = await httpClient.GetAsync("https://httpbin.org/status/400", TestContext.Current.CancellationToken);
Assert.Equal(HttpStatusCode.BadRequest, response.StatusCode);

response = await httpClient.GetAsync("https://httpbin.org/status/500");
response = await httpClient.GetAsync("https://httpbin.org/status/500", TestContext.Current.CancellationToken);
Assert.Equal(HttpStatusCode.NotFound, response.StatusCode);
}

Expand All @@ -128,7 +128,7 @@ public async Task SimulateTimeout_WillThrowExceptionSimulatingTheTimeout()
testHandler.RespondWith(Timeout());

using HttpClient httpClient = new(testHandler);
await Assert.ThrowsAsync<TaskCanceledException>(() => httpClient.GetAsync("https://httpbin.org/delay/500"));
await Assert.ThrowsAsync<TaskCanceledException>(() => httpClient.GetAsync("https://httpbin.org/delay/500", TestContext.Current.CancellationToken));
}

[Fact]
Expand All @@ -143,20 +143,20 @@ public async Task UsingTestHandlerWithSequencedResponses_WillReturnDifferentResp
));

using HttpClient httpClient = new(testHandler);
HttpResponseMessage response = await httpClient.GetAsync("http://httpbin.org/anything");
HttpResponseMessage response = await httpClient.GetAsync("http://httpbin.org/anything", TestContext.Current.CancellationToken);
Assert.Equal(HttpStatusCode.OK, response.StatusCode);

response = await httpClient.GetAsync("http://httpbin.org/anything");
response = await httpClient.GetAsync("http://httpbin.org/anything", TestContext.Current.CancellationToken);
Assert.Equal(HttpStatusCode.Unauthorized, response.StatusCode);

response = await httpClient.GetAsync("http://httpbin.org/anything");
response = await httpClient.GetAsync("http://httpbin.org/anything", TestContext.Current.CancellationToken);
Assert.Equal(HttpStatusCode.NoContent, response.StatusCode);

response = await httpClient.GetAsync("http://httpbin.org/anything");
response = await httpClient.GetAsync("http://httpbin.org/anything", TestContext.Current.CancellationToken);
Assert.Equal(HttpStatusCode.NotFound, response.StatusCode);

// Last configured response is returned when all other responses are used.
response = await httpClient.GetAsync("http://httpbin.org/anything");
response = await httpClient.GetAsync("http://httpbin.org/anything", TestContext.Current.CancellationToken);
Assert.Equal(HttpStatusCode.NotFound, response.StatusCode);
}

Expand All @@ -167,7 +167,7 @@ public async Task UsingTestHandlerWithDelayedResponses_WillDelayTheResponse()
testHandler.RespondWith(Delayed(StatusCode(HttpStatusCode.OK), TimeSpan.FromSeconds(1)));

using HttpClient httpClient = new(testHandler);
HttpResponseMessage response = await httpClient.GetAsync("http://httpbin.org/anything");
HttpResponseMessage response = await httpClient.GetAsync("http://httpbin.org/anything", TestContext.Current.CancellationToken);
Assert.Equal(HttpStatusCode.OK, response.StatusCode);
}

Expand All @@ -178,7 +178,7 @@ public async Task UsingTestHandlerWithConfiguredResponses_WillConfigureTheRespon
testHandler.RespondWith(Configured(StatusCode(HttpStatusCode.NoContent), x => x.Headers.Add("server", "test")));

using HttpClient httpClient = new(testHandler);
HttpResponseMessage response = await httpClient.GetAsync("http://httpbin.org/anything");
HttpResponseMessage response = await httpClient.GetAsync("http://httpbin.org/anything", TestContext.Current.CancellationToken);
Assert.Equal("test", response.Headers.Server.ToString());
}
}
6 changes: 3 additions & 3 deletions test/TestableHttpClient.IntegrationTests/CreatingClients.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ public async Task CreateASimpleHttpClient()
using TestableHttpMessageHandler testableHttpMessageHandler = new();
using HttpClient client = testableHttpMessageHandler.CreateClient();

await client.GetAsync("https://httpbin.org/get");
await client.GetAsync("https://httpbin.org/get", TestContext.Current.CancellationToken);

testableHttpMessageHandler.ShouldHaveMadeRequestsTo("https://httpbin.org/get");
}
Expand All @@ -21,7 +21,7 @@ public async Task CreateClientWithConfiguration()
using TestableHttpMessageHandler testableHttpMessageHandler = new();
using HttpClient client = testableHttpMessageHandler.CreateClient(client => client.DefaultRequestHeaders.Add("test", "test"));

await client.GetAsync("https://httpbin.org/get");
await client.GetAsync("https://httpbin.org/get", TestContext.Current.CancellationToken);

testableHttpMessageHandler.ShouldHaveMadeRequests().WithRequestHeader("test", "test");
}
Expand All @@ -33,7 +33,7 @@ public async Task CreateClientWithCustomHandlers()
using TestHandler handler = new();
using HttpClient client = testableHttpMessageHandler.CreateClient(handler);

await client.GetAsync("https://httpbin.org/get");
await client.GetAsync("https://httpbin.org/get", TestContext.Current.CancellationToken);

testableHttpMessageHandler.ShouldHaveMadeRequestsTo("https://httpbin.org/get");
Assert.True(handler.WasCalled);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
sut.RespondWith(Json(new { Name = "Charlie" }));
using HttpClient client = sut.CreateClient();

string json = await client.GetStringAsync("http://localhost/myjson");

Check warning on line 17 in test/TestableHttpClient.IntegrationTests/CustomizeJsonSerialization.cs

View workflow job for this annotation

GitHub Actions / testOnSupportedDotnetVersions (ubuntu-22.04)

Calls to methods which accept CancellationToken should use TestContext.Current.CancellationToken to allow test cancellation to be more responsive. (https://xunit.net/xunit.analyzers/rules/xUnit1051)

Check warning on line 17 in test/TestableHttpClient.IntegrationTests/CustomizeJsonSerialization.cs

View workflow job for this annotation

GitHub Actions / testOnSupportedDotnetVersions (ubuntu-22.04)

Calls to methods which accept CancellationToken should use TestContext.Current.CancellationToken to allow test cancellation to be more responsive. (https://xunit.net/xunit.analyzers/rules/xUnit1051)

Check warning on line 17 in test/TestableHttpClient.IntegrationTests/CustomizeJsonSerialization.cs

View workflow job for this annotation

GitHub Actions / testOnSupportedDotnetVersions (ubuntu-22.04)

Calls to methods which accept CancellationToken should use TestContext.Current.CancellationToken to allow test cancellation to be more responsive. (https://xunit.net/xunit.analyzers/rules/xUnit1051)

Check warning on line 17 in test/TestableHttpClient.IntegrationTests/CustomizeJsonSerialization.cs

View workflow job for this annotation

GitHub Actions / testOnSupportedDotnetVersions (ubuntu-22.04)

Calls to methods which accept CancellationToken should use TestContext.Current.CancellationToken to allow test cancellation to be more responsive. (https://xunit.net/xunit.analyzers/rules/xUnit1051)

Check warning on line 17 in test/TestableHttpClient.IntegrationTests/CustomizeJsonSerialization.cs

View workflow job for this annotation

GitHub Actions / testOnSupportedDotnetVersions (ubuntu-22.04)

Calls to methods which accept CancellationToken should use TestContext.Current.CancellationToken to allow test cancellation to be more responsive. (https://xunit.net/xunit.analyzers/rules/xUnit1051)

Check warning on line 17 in test/TestableHttpClient.IntegrationTests/CustomizeJsonSerialization.cs

View workflow job for this annotation

GitHub Actions / testOnSupportedDotnetVersions (ubuntu-22.04)

Calls to methods which accept CancellationToken should use TestContext.Current.CancellationToken to allow test cancellation to be more responsive. (https://xunit.net/xunit.analyzers/rules/xUnit1051)

Check warning on line 17 in test/TestableHttpClient.IntegrationTests/CustomizeJsonSerialization.cs

View workflow job for this annotation

GitHub Actions / testOnSupportedDotnetVersions (ubuntu-22.04)

Calls to methods which accept CancellationToken should use TestContext.Current.CancellationToken to allow test cancellation to be more responsive. (https://xunit.net/xunit.analyzers/rules/xUnit1051)

Check warning on line 17 in test/TestableHttpClient.IntegrationTests/CustomizeJsonSerialization.cs

View workflow job for this annotation

GitHub Actions / testOnSupportedDotnetVersions (ubuntu-22.04)

Calls to methods which accept CancellationToken should use TestContext.Current.CancellationToken to allow test cancellation to be more responsive. (https://xunit.net/xunit.analyzers/rules/xUnit1051)

Check warning on line 17 in test/TestableHttpClient.IntegrationTests/CustomizeJsonSerialization.cs

View workflow job for this annotation

GitHub Actions / Analyze

Calls to methods which accept CancellationToken should use TestContext.Current.CancellationToken to allow test cancellation to be more responsive. (https://xunit.net/xunit.analyzers/rules/xUnit1051)

Check warning on line 17 in test/TestableHttpClient.IntegrationTests/CustomizeJsonSerialization.cs

View workflow job for this annotation

GitHub Actions / Analyze

Calls to methods which accept CancellationToken should use TestContext.Current.CancellationToken to allow test cancellation to be more responsive. (https://xunit.net/xunit.analyzers/rules/xUnit1051)

Check warning on line 17 in test/TestableHttpClient.IntegrationTests/CustomizeJsonSerialization.cs

View workflow job for this annotation

GitHub Actions / build

Calls to methods which accept CancellationToken should use TestContext.Current.CancellationToken to allow test cancellation to be more responsive. (https://xunit.net/xunit.analyzers/rules/xUnit1051)

Check warning on line 17 in test/TestableHttpClient.IntegrationTests/CustomizeJsonSerialization.cs

View workflow job for this annotation

GitHub Actions / build

Calls to methods which accept CancellationToken should use TestContext.Current.CancellationToken to allow test cancellation to be more responsive. (https://xunit.net/xunit.analyzers/rules/xUnit1051)

Check warning on line 17 in test/TestableHttpClient.IntegrationTests/CustomizeJsonSerialization.cs

View workflow job for this annotation

GitHub Actions / build

Calls to methods which accept CancellationToken should use TestContext.Current.CancellationToken to allow test cancellation to be more responsive.

Check warning on line 17 in test/TestableHttpClient.IntegrationTests/CustomizeJsonSerialization.cs

View workflow job for this annotation

GitHub Actions / build

Calls to methods which accept CancellationToken should use TestContext.Current.CancellationToken to allow test cancellation to be more responsive.

Check warning on line 17 in test/TestableHttpClient.IntegrationTests/CustomizeJsonSerialization.cs

View workflow job for this annotation

GitHub Actions / Analyze

Calls to methods which accept CancellationToken should use TestContext.Current.CancellationToken to allow test cancellation to be more responsive. (https://xunit.net/xunit.analyzers/rules/xUnit1051)

Check warning on line 17 in test/TestableHttpClient.IntegrationTests/CustomizeJsonSerialization.cs

View workflow job for this annotation

GitHub Actions / Analyze

Calls to methods which accept CancellationToken should use TestContext.Current.CancellationToken to allow test cancellation to be more responsive. (https://xunit.net/xunit.analyzers/rules/xUnit1051)

Check warning on line 17 in test/TestableHttpClient.IntegrationTests/CustomizeJsonSerialization.cs

View workflow job for this annotation

GitHub Actions / testOnSupportedDotnetVersions (windows-latest)

Calls to methods which accept CancellationToken should use TestContext.Current.CancellationToken to allow test cancellation to be more responsive. (https://xunit.net/xunit.analyzers/rules/xUnit1051)

Check warning on line 17 in test/TestableHttpClient.IntegrationTests/CustomizeJsonSerialization.cs

View workflow job for this annotation

GitHub Actions / testOnSupportedDotnetVersions (windows-latest)

Calls to methods which accept CancellationToken should use TestContext.Current.CancellationToken to allow test cancellation to be more responsive. (https://xunit.net/xunit.analyzers/rules/xUnit1051)

Check warning on line 17 in test/TestableHttpClient.IntegrationTests/CustomizeJsonSerialization.cs

View workflow job for this annotation

GitHub Actions / testOnSupportedDotnetVersions (windows-latest)

Calls to methods which accept CancellationToken should use TestContext.Current.CancellationToken to allow test cancellation to be more responsive. (https://xunit.net/xunit.analyzers/rules/xUnit1051)

Check warning on line 17 in test/TestableHttpClient.IntegrationTests/CustomizeJsonSerialization.cs

View workflow job for this annotation

GitHub Actions / testOnSupportedDotnetVersions (windows-latest)

Calls to methods which accept CancellationToken should use TestContext.Current.CancellationToken to allow test cancellation to be more responsive. (https://xunit.net/xunit.analyzers/rules/xUnit1051)

Check warning on line 17 in test/TestableHttpClient.IntegrationTests/CustomizeJsonSerialization.cs

View workflow job for this annotation

GitHub Actions / build

Calls to methods which accept CancellationToken should use TestContext.Current.CancellationToken to allow test cancellation to be more responsive. (https://xunit.net/xunit.analyzers/rules/xUnit1051)

Check warning on line 17 in test/TestableHttpClient.IntegrationTests/CustomizeJsonSerialization.cs

View workflow job for this annotation

GitHub Actions / build

Calls to methods which accept CancellationToken should use TestContext.Current.CancellationToken to allow test cancellation to be more responsive. (https://xunit.net/xunit.analyzers/rules/xUnit1051)

Check warning on line 17 in test/TestableHttpClient.IntegrationTests/CustomizeJsonSerialization.cs

View workflow job for this annotation

GitHub Actions / build

Calls to methods which accept CancellationToken should use TestContext.Current.CancellationToken to allow test cancellation to be more responsive. (https://xunit.net/xunit.analyzers/rules/xUnit1051)

Check warning on line 17 in test/TestableHttpClient.IntegrationTests/CustomizeJsonSerialization.cs

View workflow job for this annotation

GitHub Actions / build

Calls to methods which accept CancellationToken should use TestContext.Current.CancellationToken to allow test cancellation to be more responsive. (https://xunit.net/xunit.analyzers/rules/xUnit1051)

Check warning on line 17 in test/TestableHttpClient.IntegrationTests/CustomizeJsonSerialization.cs

View workflow job for this annotation

GitHub Actions / build

Calls to methods which accept CancellationToken should use TestContext.Current.CancellationToken to allow test cancellation to be more responsive.

Check warning on line 17 in test/TestableHttpClient.IntegrationTests/CustomizeJsonSerialization.cs

View workflow job for this annotation

GitHub Actions / build

Calls to methods which accept CancellationToken should use TestContext.Current.CancellationToken to allow test cancellation to be more responsive.

Check warning on line 17 in test/TestableHttpClient.IntegrationTests/CustomizeJsonSerialization.cs

View workflow job for this annotation

GitHub Actions / testOnSupportedDotnetVersions (windows-latest)

Calls to methods which accept CancellationToken should use TestContext.Current.CancellationToken to allow test cancellation to be more responsive. (https://xunit.net/xunit.analyzers/rules/xUnit1051)

Check warning on line 17 in test/TestableHttpClient.IntegrationTests/CustomizeJsonSerialization.cs

View workflow job for this annotation

GitHub Actions / testOnSupportedDotnetVersions (windows-latest)

Calls to methods which accept CancellationToken should use TestContext.Current.CancellationToken to allow test cancellation to be more responsive. (https://xunit.net/xunit.analyzers/rules/xUnit1051)

Check warning on line 17 in test/TestableHttpClient.IntegrationTests/CustomizeJsonSerialization.cs

View workflow job for this annotation

GitHub Actions / testOnSupportedDotnetVersions (windows-latest)

Calls to methods which accept CancellationToken should use TestContext.Current.CancellationToken to allow test cancellation to be more responsive. (https://xunit.net/xunit.analyzers/rules/xUnit1051)

Check warning on line 17 in test/TestableHttpClient.IntegrationTests/CustomizeJsonSerialization.cs

View workflow job for this annotation

GitHub Actions / testOnSupportedDotnetVersions (windows-latest)

Calls to methods which accept CancellationToken should use TestContext.Current.CancellationToken to allow test cancellation to be more responsive. (https://xunit.net/xunit.analyzers/rules/xUnit1051)

Assert.Equal("{\"name\":\"Charlie\"}", json);
}
Expand All @@ -27,7 +27,7 @@
sut.RespondWith(Json(new { Name = "Charlie" }));
using HttpClient client = sut.CreateClient();

string json = await client.GetStringAsync("http://localhost/myjson");

Check warning on line 30 in test/TestableHttpClient.IntegrationTests/CustomizeJsonSerialization.cs

View workflow job for this annotation

GitHub Actions / testOnSupportedDotnetVersions (ubuntu-22.04)

Calls to methods which accept CancellationToken should use TestContext.Current.CancellationToken to allow test cancellation to be more responsive. (https://xunit.net/xunit.analyzers/rules/xUnit1051)

Check warning on line 30 in test/TestableHttpClient.IntegrationTests/CustomizeJsonSerialization.cs

View workflow job for this annotation

GitHub Actions / testOnSupportedDotnetVersions (ubuntu-22.04)

Calls to methods which accept CancellationToken should use TestContext.Current.CancellationToken to allow test cancellation to be more responsive. (https://xunit.net/xunit.analyzers/rules/xUnit1051)

Check warning on line 30 in test/TestableHttpClient.IntegrationTests/CustomizeJsonSerialization.cs

View workflow job for this annotation

GitHub Actions / testOnSupportedDotnetVersions (ubuntu-22.04)

Calls to methods which accept CancellationToken should use TestContext.Current.CancellationToken to allow test cancellation to be more responsive. (https://xunit.net/xunit.analyzers/rules/xUnit1051)

Check warning on line 30 in test/TestableHttpClient.IntegrationTests/CustomizeJsonSerialization.cs

View workflow job for this annotation

GitHub Actions / testOnSupportedDotnetVersions (ubuntu-22.04)

Calls to methods which accept CancellationToken should use TestContext.Current.CancellationToken to allow test cancellation to be more responsive. (https://xunit.net/xunit.analyzers/rules/xUnit1051)

Check warning on line 30 in test/TestableHttpClient.IntegrationTests/CustomizeJsonSerialization.cs

View workflow job for this annotation

GitHub Actions / testOnSupportedDotnetVersions (ubuntu-22.04)

Calls to methods which accept CancellationToken should use TestContext.Current.CancellationToken to allow test cancellation to be more responsive. (https://xunit.net/xunit.analyzers/rules/xUnit1051)

Check warning on line 30 in test/TestableHttpClient.IntegrationTests/CustomizeJsonSerialization.cs

View workflow job for this annotation

GitHub Actions / testOnSupportedDotnetVersions (ubuntu-22.04)

Calls to methods which accept CancellationToken should use TestContext.Current.CancellationToken to allow test cancellation to be more responsive. (https://xunit.net/xunit.analyzers/rules/xUnit1051)

Check warning on line 30 in test/TestableHttpClient.IntegrationTests/CustomizeJsonSerialization.cs

View workflow job for this annotation

GitHub Actions / Analyze

Calls to methods which accept CancellationToken should use TestContext.Current.CancellationToken to allow test cancellation to be more responsive. (https://xunit.net/xunit.analyzers/rules/xUnit1051)

Check warning on line 30 in test/TestableHttpClient.IntegrationTests/CustomizeJsonSerialization.cs

View workflow job for this annotation

GitHub Actions / Analyze

Calls to methods which accept CancellationToken should use TestContext.Current.CancellationToken to allow test cancellation to be more responsive. (https://xunit.net/xunit.analyzers/rules/xUnit1051)

Check warning on line 30 in test/TestableHttpClient.IntegrationTests/CustomizeJsonSerialization.cs

View workflow job for this annotation

GitHub Actions / build

Calls to methods which accept CancellationToken should use TestContext.Current.CancellationToken to allow test cancellation to be more responsive. (https://xunit.net/xunit.analyzers/rules/xUnit1051)

Check warning on line 30 in test/TestableHttpClient.IntegrationTests/CustomizeJsonSerialization.cs

View workflow job for this annotation

GitHub Actions / build

Calls to methods which accept CancellationToken should use TestContext.Current.CancellationToken to allow test cancellation to be more responsive. (https://xunit.net/xunit.analyzers/rules/xUnit1051)

Check warning on line 30 in test/TestableHttpClient.IntegrationTests/CustomizeJsonSerialization.cs

View workflow job for this annotation

GitHub Actions / build

Calls to methods which accept CancellationToken should use TestContext.Current.CancellationToken to allow test cancellation to be more responsive.

Check warning on line 30 in test/TestableHttpClient.IntegrationTests/CustomizeJsonSerialization.cs

View workflow job for this annotation

GitHub Actions / build

Calls to methods which accept CancellationToken should use TestContext.Current.CancellationToken to allow test cancellation to be more responsive.

Check warning on line 30 in test/TestableHttpClient.IntegrationTests/CustomizeJsonSerialization.cs

View workflow job for this annotation

GitHub Actions / Analyze

Calls to methods which accept CancellationToken should use TestContext.Current.CancellationToken to allow test cancellation to be more responsive. (https://xunit.net/xunit.analyzers/rules/xUnit1051)

Check warning on line 30 in test/TestableHttpClient.IntegrationTests/CustomizeJsonSerialization.cs

View workflow job for this annotation

GitHub Actions / Analyze

Calls to methods which accept CancellationToken should use TestContext.Current.CancellationToken to allow test cancellation to be more responsive. (https://xunit.net/xunit.analyzers/rules/xUnit1051)

Check warning on line 30 in test/TestableHttpClient.IntegrationTests/CustomizeJsonSerialization.cs

View workflow job for this annotation

GitHub Actions / testOnSupportedDotnetVersions (windows-latest)

Calls to methods which accept CancellationToken should use TestContext.Current.CancellationToken to allow test cancellation to be more responsive. (https://xunit.net/xunit.analyzers/rules/xUnit1051)

Check warning on line 30 in test/TestableHttpClient.IntegrationTests/CustomizeJsonSerialization.cs

View workflow job for this annotation

GitHub Actions / testOnSupportedDotnetVersions (windows-latest)

Calls to methods which accept CancellationToken should use TestContext.Current.CancellationToken to allow test cancellation to be more responsive. (https://xunit.net/xunit.analyzers/rules/xUnit1051)

Check warning on line 30 in test/TestableHttpClient.IntegrationTests/CustomizeJsonSerialization.cs

View workflow job for this annotation

GitHub Actions / testOnSupportedDotnetVersions (windows-latest)

Calls to methods which accept CancellationToken should use TestContext.Current.CancellationToken to allow test cancellation to be more responsive. (https://xunit.net/xunit.analyzers/rules/xUnit1051)

Check warning on line 30 in test/TestableHttpClient.IntegrationTests/CustomizeJsonSerialization.cs

View workflow job for this annotation

GitHub Actions / build

Calls to methods which accept CancellationToken should use TestContext.Current.CancellationToken to allow test cancellation to be more responsive. (https://xunit.net/xunit.analyzers/rules/xUnit1051)

Check warning on line 30 in test/TestableHttpClient.IntegrationTests/CustomizeJsonSerialization.cs

View workflow job for this annotation

GitHub Actions / build

Calls to methods which accept CancellationToken should use TestContext.Current.CancellationToken to allow test cancellation to be more responsive. (https://xunit.net/xunit.analyzers/rules/xUnit1051)

Check warning on line 30 in test/TestableHttpClient.IntegrationTests/CustomizeJsonSerialization.cs

View workflow job for this annotation

GitHub Actions / build

Calls to methods which accept CancellationToken should use TestContext.Current.CancellationToken to allow test cancellation to be more responsive. (https://xunit.net/xunit.analyzers/rules/xUnit1051)

Check warning on line 30 in test/TestableHttpClient.IntegrationTests/CustomizeJsonSerialization.cs

View workflow job for this annotation

GitHub Actions / build

Calls to methods which accept CancellationToken should use TestContext.Current.CancellationToken to allow test cancellation to be more responsive.

Check warning on line 30 in test/TestableHttpClient.IntegrationTests/CustomizeJsonSerialization.cs

View workflow job for this annotation

GitHub Actions / build

Calls to methods which accept CancellationToken should use TestContext.Current.CancellationToken to allow test cancellation to be more responsive.

Check warning on line 30 in test/TestableHttpClient.IntegrationTests/CustomizeJsonSerialization.cs

View workflow job for this annotation

GitHub Actions / testOnSupportedDotnetVersions (windows-latest)

Calls to methods which accept CancellationToken should use TestContext.Current.CancellationToken to allow test cancellation to be more responsive. (https://xunit.net/xunit.analyzers/rules/xUnit1051)

Check warning on line 30 in test/TestableHttpClient.IntegrationTests/CustomizeJsonSerialization.cs

View workflow job for this annotation

GitHub Actions / testOnSupportedDotnetVersions (windows-latest)

Calls to methods which accept CancellationToken should use TestContext.Current.CancellationToken to allow test cancellation to be more responsive. (https://xunit.net/xunit.analyzers/rules/xUnit1051)

Check warning on line 30 in test/TestableHttpClient.IntegrationTests/CustomizeJsonSerialization.cs

View workflow job for this annotation

GitHub Actions / testOnSupportedDotnetVersions (windows-latest)

Calls to methods which accept CancellationToken should use TestContext.Current.CancellationToken to allow test cancellation to be more responsive. (https://xunit.net/xunit.analyzers/rules/xUnit1051)

Assert.Equal("{\"Name\":\"Charlie\"}", json);
}
Expand All @@ -39,7 +39,7 @@
sut.RespondWith(Json(new { Name = "Charlie" }, jsonSerializerOptions: new JsonSerializerOptions()));
using HttpClient client = sut.CreateClient();

string json = await client.GetStringAsync("http://localhost/myjson");

Check warning on line 42 in test/TestableHttpClient.IntegrationTests/CustomizeJsonSerialization.cs

View workflow job for this annotation

GitHub Actions / testOnSupportedDotnetVersions (ubuntu-22.04)

Calls to methods which accept CancellationToken should use TestContext.Current.CancellationToken to allow test cancellation to be more responsive. (https://xunit.net/xunit.analyzers/rules/xUnit1051)

Check warning on line 42 in test/TestableHttpClient.IntegrationTests/CustomizeJsonSerialization.cs

View workflow job for this annotation

GitHub Actions / testOnSupportedDotnetVersions (ubuntu-22.04)

Calls to methods which accept CancellationToken should use TestContext.Current.CancellationToken to allow test cancellation to be more responsive. (https://xunit.net/xunit.analyzers/rules/xUnit1051)

Check warning on line 42 in test/TestableHttpClient.IntegrationTests/CustomizeJsonSerialization.cs

View workflow job for this annotation

GitHub Actions / testOnSupportedDotnetVersions (ubuntu-22.04)

Calls to methods which accept CancellationToken should use TestContext.Current.CancellationToken to allow test cancellation to be more responsive. (https://xunit.net/xunit.analyzers/rules/xUnit1051)

Check warning on line 42 in test/TestableHttpClient.IntegrationTests/CustomizeJsonSerialization.cs

View workflow job for this annotation

GitHub Actions / testOnSupportedDotnetVersions (ubuntu-22.04)

Calls to methods which accept CancellationToken should use TestContext.Current.CancellationToken to allow test cancellation to be more responsive. (https://xunit.net/xunit.analyzers/rules/xUnit1051)

Check warning on line 42 in test/TestableHttpClient.IntegrationTests/CustomizeJsonSerialization.cs

View workflow job for this annotation

GitHub Actions / testOnSupportedDotnetVersions (ubuntu-22.04)

Calls to methods which accept CancellationToken should use TestContext.Current.CancellationToken to allow test cancellation to be more responsive. (https://xunit.net/xunit.analyzers/rules/xUnit1051)

Check warning on line 42 in test/TestableHttpClient.IntegrationTests/CustomizeJsonSerialization.cs

View workflow job for this annotation

GitHub Actions / testOnSupportedDotnetVersions (ubuntu-22.04)

Calls to methods which accept CancellationToken should use TestContext.Current.CancellationToken to allow test cancellation to be more responsive. (https://xunit.net/xunit.analyzers/rules/xUnit1051)

Check warning on line 42 in test/TestableHttpClient.IntegrationTests/CustomizeJsonSerialization.cs

View workflow job for this annotation

GitHub Actions / Analyze

Calls to methods which accept CancellationToken should use TestContext.Current.CancellationToken to allow test cancellation to be more responsive. (https://xunit.net/xunit.analyzers/rules/xUnit1051)

Check warning on line 42 in test/TestableHttpClient.IntegrationTests/CustomizeJsonSerialization.cs

View workflow job for this annotation

GitHub Actions / Analyze

Calls to methods which accept CancellationToken should use TestContext.Current.CancellationToken to allow test cancellation to be more responsive. (https://xunit.net/xunit.analyzers/rules/xUnit1051)

Check warning on line 42 in test/TestableHttpClient.IntegrationTests/CustomizeJsonSerialization.cs

View workflow job for this annotation

GitHub Actions / build

Calls to methods which accept CancellationToken should use TestContext.Current.CancellationToken to allow test cancellation to be more responsive. (https://xunit.net/xunit.analyzers/rules/xUnit1051)

Check warning on line 42 in test/TestableHttpClient.IntegrationTests/CustomizeJsonSerialization.cs

View workflow job for this annotation

GitHub Actions / build

Calls to methods which accept CancellationToken should use TestContext.Current.CancellationToken to allow test cancellation to be more responsive. (https://xunit.net/xunit.analyzers/rules/xUnit1051)

Check warning on line 42 in test/TestableHttpClient.IntegrationTests/CustomizeJsonSerialization.cs

View workflow job for this annotation

GitHub Actions / build

Calls to methods which accept CancellationToken should use TestContext.Current.CancellationToken to allow test cancellation to be more responsive.

Check warning on line 42 in test/TestableHttpClient.IntegrationTests/CustomizeJsonSerialization.cs

View workflow job for this annotation

GitHub Actions / build

Calls to methods which accept CancellationToken should use TestContext.Current.CancellationToken to allow test cancellation to be more responsive.

Check warning on line 42 in test/TestableHttpClient.IntegrationTests/CustomizeJsonSerialization.cs

View workflow job for this annotation

GitHub Actions / Analyze

Calls to methods which accept CancellationToken should use TestContext.Current.CancellationToken to allow test cancellation to be more responsive. (https://xunit.net/xunit.analyzers/rules/xUnit1051)

Check warning on line 42 in test/TestableHttpClient.IntegrationTests/CustomizeJsonSerialization.cs

View workflow job for this annotation

GitHub Actions / Analyze

Calls to methods which accept CancellationToken should use TestContext.Current.CancellationToken to allow test cancellation to be more responsive. (https://xunit.net/xunit.analyzers/rules/xUnit1051)

Check warning on line 42 in test/TestableHttpClient.IntegrationTests/CustomizeJsonSerialization.cs

View workflow job for this annotation

GitHub Actions / testOnSupportedDotnetVersions (windows-latest)

Calls to methods which accept CancellationToken should use TestContext.Current.CancellationToken to allow test cancellation to be more responsive. (https://xunit.net/xunit.analyzers/rules/xUnit1051)

Check warning on line 42 in test/TestableHttpClient.IntegrationTests/CustomizeJsonSerialization.cs

View workflow job for this annotation

GitHub Actions / testOnSupportedDotnetVersions (windows-latest)

Calls to methods which accept CancellationToken should use TestContext.Current.CancellationToken to allow test cancellation to be more responsive. (https://xunit.net/xunit.analyzers/rules/xUnit1051)

Check warning on line 42 in test/TestableHttpClient.IntegrationTests/CustomizeJsonSerialization.cs

View workflow job for this annotation

GitHub Actions / testOnSupportedDotnetVersions (windows-latest)

Calls to methods which accept CancellationToken should use TestContext.Current.CancellationToken to allow test cancellation to be more responsive. (https://xunit.net/xunit.analyzers/rules/xUnit1051)

Check warning on line 42 in test/TestableHttpClient.IntegrationTests/CustomizeJsonSerialization.cs

View workflow job for this annotation

GitHub Actions / build

Calls to methods which accept CancellationToken should use TestContext.Current.CancellationToken to allow test cancellation to be more responsive. (https://xunit.net/xunit.analyzers/rules/xUnit1051)

Check warning on line 42 in test/TestableHttpClient.IntegrationTests/CustomizeJsonSerialization.cs

View workflow job for this annotation

GitHub Actions / build

Calls to methods which accept CancellationToken should use TestContext.Current.CancellationToken to allow test cancellation to be more responsive. (https://xunit.net/xunit.analyzers/rules/xUnit1051)

Check warning on line 42 in test/TestableHttpClient.IntegrationTests/CustomizeJsonSerialization.cs

View workflow job for this annotation

GitHub Actions / build

Calls to methods which accept CancellationToken should use TestContext.Current.CancellationToken to allow test cancellation to be more responsive. (https://xunit.net/xunit.analyzers/rules/xUnit1051)

Check warning on line 42 in test/TestableHttpClient.IntegrationTests/CustomizeJsonSerialization.cs

View workflow job for this annotation

GitHub Actions / build

Calls to methods which accept CancellationToken should use TestContext.Current.CancellationToken to allow test cancellation to be more responsive.

Check warning on line 42 in test/TestableHttpClient.IntegrationTests/CustomizeJsonSerialization.cs

View workflow job for this annotation

GitHub Actions / build

Calls to methods which accept CancellationToken should use TestContext.Current.CancellationToken to allow test cancellation to be more responsive.

Check warning on line 42 in test/TestableHttpClient.IntegrationTests/CustomizeJsonSerialization.cs

View workflow job for this annotation

GitHub Actions / testOnSupportedDotnetVersions (windows-latest)

Calls to methods which accept CancellationToken should use TestContext.Current.CancellationToken to allow test cancellation to be more responsive. (https://xunit.net/xunit.analyzers/rules/xUnit1051)

Check warning on line 42 in test/TestableHttpClient.IntegrationTests/CustomizeJsonSerialization.cs

View workflow job for this annotation

GitHub Actions / testOnSupportedDotnetVersions (windows-latest)

Calls to methods which accept CancellationToken should use TestContext.Current.CancellationToken to allow test cancellation to be more responsive. (https://xunit.net/xunit.analyzers/rules/xUnit1051)

Check warning on line 42 in test/TestableHttpClient.IntegrationTests/CustomizeJsonSerialization.cs

View workflow job for this annotation

GitHub Actions / testOnSupportedDotnetVersions (windows-latest)

Calls to methods which accept CancellationToken should use TestContext.Current.CancellationToken to allow test cancellation to be more responsive. (https://xunit.net/xunit.analyzers/rules/xUnit1051)

Assert.Equal("{\"Name\":\"Charlie\"}", json);
}
Expand All @@ -49,7 +49,7 @@
{
using TestableHttpMessageHandler sut = new();
using HttpClient client = sut.CreateClient();
await client.PostAsJsonAsync("http://localhost", new { Name = "Charlie" });
await client.PostAsJsonAsync("http://localhost", new { Name = "Charlie" }, cancellationToken: TestContext.Current.CancellationToken);

#if NETFRAMEWORK
// Well this doesn't really work on .NET Framework.
Expand All @@ -70,7 +70,7 @@
WriteIndented = true
};

await client.PostAsJsonAsync("http://localhost", new { Name = "Charlie" }, options);
await client.PostAsJsonAsync("http://localhost", new { Name = "Charlie" }, options, cancellationToken: TestContext.Current.CancellationToken);

#if NETFRAMEWORK
// Well this doesn't really work on .NET Framework.
Expand Down
15 changes: 15 additions & 0 deletions test/TestableHttpClient.IntegrationTests/NetFrameworkPollyFill.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
using System.Threading;

namespace TestableHttpClient.IntegrationTests;

#if NETFRAMEWORK

internal static class NetFrameworkPollyFill
{
public static Task<string> ReadAsStringAsync(this HttpContent content, CancellationToken cancellationToken = default)

Check warning on line 9 in test/TestableHttpClient.IntegrationTests/NetFrameworkPollyFill.cs

View workflow job for this annotation

GitHub Actions / build

Remove unused parameter 'cancellationToken'

Check warning on line 9 in test/TestableHttpClient.IntegrationTests/NetFrameworkPollyFill.cs

View workflow job for this annotation

GitHub Actions / build

Remove unused parameter 'cancellationToken'

Check warning on line 9 in test/TestableHttpClient.IntegrationTests/NetFrameworkPollyFill.cs

View workflow job for this annotation

GitHub Actions / build

Remove unused parameter 'cancellationToken'

Check warning on line 9 in test/TestableHttpClient.IntegrationTests/NetFrameworkPollyFill.cs

View workflow job for this annotation

GitHub Actions / build

Remove unused parameter 'cancellationToken'
{
return content.ReadAsStringAsync();
}
}

#endif
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFrameworks>net462;net47;net48;net8.0;net9.0</TargetFrameworks>
<TargetFrameworks>net472;net48;net8.0;net9.0</TargetFrameworks>
<OutputType>Exe</OutputType>
</PropertyGroup>

<ItemGroup Condition="'$(TargetFrameworkIdentifier)' == '.NETFramework'">
Expand Down
Loading
Loading