Merge pull request #325 from kvpt/dev
HttpTest use AsyncLocal like NetStandard in NetFramework 4.6 and later
This commit is contained in:
commit
b0e3a6a1f3
@ -1,7 +1,7 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFrameworks>net45;netstandard1.1;netstandard1.3;netstandard2.0;</TargetFrameworks>
|
||||
<TargetFrameworks>net45;net46;netstandard1.1;netstandard1.3;netstandard2.0;</TargetFrameworks>
|
||||
<TargetFrameworks Condition="'$(OS)' != 'Windows_NT'">netstandard1.1;netstandard1.3;netstandard2.0;</TargetFrameworks>
|
||||
<GeneratePackageOnBuild>True</GeneratePackageOnBuild>
|
||||
<PackageId>Flurl.Http</PackageId>
|
||||
@ -55,6 +55,10 @@
|
||||
<ItemGroup Condition="'$(TargetFramework)' == 'net45'">
|
||||
<Reference Include="System.Net.Http" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup Condition="'$(TargetFramework)' == 'net46'">
|
||||
<Reference Include="System.Net.Http" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\Flurl\Flurl.csproj" />
|
||||
|
@ -13,8 +13,8 @@ namespace Flurl.Http.Testing
|
||||
/// An object whose existence puts Flurl.Http into test mode where actual HTTP calls are faked. Provides a response
|
||||
/// queue, call log, and assertion helpers for use in Arrange/Act/Assert style tests.
|
||||
/// </summary>
|
||||
#if !NETSTANDARD1_1
|
||||
[Serializable] // fixes MSTest issue? #207
|
||||
#if NET45
|
||||
[Serializable]
|
||||
#endif
|
||||
public class HttpTest : IDisposable
|
||||
{
|
||||
@ -179,7 +179,7 @@ namespace Flurl.Http.Testing
|
||||
#if NET45
|
||||
private static void SetCurrentTest(HttpTest test) => System.Runtime.Remoting.Messaging.CallContext.LogicalSetData("FlurlHttpTest", test);
|
||||
private static HttpTest GetCurrentTest() => System.Runtime.Remoting.Messaging.CallContext.LogicalGetData("FlurlHttpTest") as HttpTest;
|
||||
#elif NETSTANDARD1_3 || NETSTANDARD2_0
|
||||
#elif NET46 || NETSTANDARD1_3 || NETSTANDARD2_0
|
||||
private static System.Threading.AsyncLocal<HttpTest> _test = new System.Threading.AsyncLocal<HttpTest>();
|
||||
private static void SetCurrentTest(HttpTest test) => _test.Value = test;
|
||||
private static HttpTest GetCurrentTest() => _test.Value;
|
||||
|
Loading…
x
Reference in New Issue
Block a user