File tree Expand file tree Collapse file tree 6 files changed +55
-43
lines changed
ResponseCaching.Test.WebHost Expand file tree Collapse file tree 6 files changed +55
-43
lines changed Original file line number Diff line number Diff line change 2323 </PropertyGroup >
2424
2525 <ItemGroup Condition =" '$(Configuration)' == 'Release'" >
26- <PackageReference Include =" Microsoft.SourceLink.GitHub" Version =" 1 .*" PrivateAssets =" All" />
26+ <PackageReference Include =" Microsoft.SourceLink.GitHub" Version =" 8 .*" PrivateAssets =" All" />
2727 </ItemGroup >
2828
2929 <PropertyGroup Condition =" '$(GITHUB_ACTIONS)' == 'true'" >
Original file line number Diff line number Diff line change 1010 </PropertyGroup >
1111
1212 <ItemGroup >
13- <PackageReference Include =" IdentityModel" Version =" 5 .*" />
13+ <PackageReference Include =" IdentityModel" Version =" 6 .*" />
1414 </ItemGroup >
1515
1616 <ItemGroup Condition =" '$(Configuration)' == 'DEBUG'" >
Load Diff This file was deleted.
Original file line number Diff line number Diff line change 1+ using System ;
2+ using System . Net . Http ;
3+
4+ using Cuture . Http ;
5+
6+ namespace ResponseCaching . Test . Base ;
7+
8+ internal class TestCutureHttpMessageInvokerPool : IHttpMessageInvokerPool
9+ {
10+ #region Private 字段
11+
12+ private readonly HttpClient _testHttpClient ;
13+
14+ private readonly HttpMessageInvokerOwner _testHttpClientOwner ;
15+
16+ #endregion Private 字段
17+
18+ #region Public 构造函数
19+
20+ public TestCutureHttpMessageInvokerPool ( HttpClient testHttpClient )
21+ {
22+ _testHttpClient = testHttpClient ?? throw new ArgumentNullException ( nameof ( testHttpClient ) ) ;
23+ _testHttpClientOwner = new ( _testHttpClient ) ;
24+ }
25+
26+ #endregion Public 构造函数
27+
28+ #region Public 方法
29+
30+ public void Dispose ( )
31+ {
32+ }
33+
34+ public IOwner < HttpMessageInvoker > Rent ( IHttpRequest request ) => _testHttpClientOwner ;
35+
36+ #endregion Public 方法
37+
38+ #region Private 类
39+
40+ private record class HttpMessageInvokerOwner ( HttpMessageInvoker Value ) : IOwner < HttpMessageInvoker >
41+ {
42+ #region Public 方法
43+
44+ public void Dispose ( ) { }
45+
46+ #endregion Public 方法
47+ }
48+
49+ #endregion Private 类
50+ }
Original file line number Diff line number Diff line change @@ -49,7 +49,7 @@ public virtual async Task InitAsync()
4949 await ConfigureWebHost ( hostBuilder ) ;
5050 WebHost = await hostBuilder . StartAsync ( ) ;
5151
52- HttpRequestGlobalOptions . DefaultHttpMessageInvokerFactory = new TestCutureHttpClientFactory ( WebHost . GetTestClient ( ) ) ;
52+ HttpRequestGlobalOptions . DefaultHttpMessageInvokerPool = new TestCutureHttpMessageInvokerPool ( WebHost . GetTestClient ( ) ) ;
5353
5454 HttpRequestGlobalOptions . DefaultConnectionLimit = 500 ;
5555 }
Original file line number Diff line number Diff line change 55 </PropertyGroup >
66
77 <ItemGroup >
8- <PackageReference Include =" Cuture.Http" Version =" 2.1.1 " />
8+ <PackageReference Include =" Cuture.Http" Version =" 2.* " />
99 <PackageReference Include =" Microsoft.NET.Test.Sdk" Version =" 17.*" />
1010 <PackageReference Include =" MSTest.TestAdapter" Version =" 3.*" />
1111 <PackageReference Include =" MSTest.TestFramework" Version =" 3.*" />
12- <PackageReference Include =" coverlet.collector" Version =" 3 .*" >
12+ <PackageReference Include =" coverlet.collector" Version =" 6 .*" >
1313 <PrivateAssets >all</PrivateAssets >
1414 <IncludeAssets >runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets >
1515 </PackageReference >
You can’t perform that action at this time.
0 commit comments