Skip to content

Commit a5ad266

Browse files
committed
Move to xUnit and some cleanup
1 parent d23cd87 commit a5ad266

File tree

20 files changed

+197
-224
lines changed

20 files changed

+197
-224
lines changed

.editorconfig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ resharper_int_align_switch_expressions = true
2727
resharper_int_align_switch_sections = true
2828
resharper_int_align_variables = true
2929
resharper_place_accessorholder_attribute_on_same_line = false
30-
resharper_place_expr_method_on_single_line = false
30+
resharper_place_expr_method_on_single_line = if_owner_is_single_line
3131
resharper_place_expr_property_on_single_line = true
3232
resharper_place_simple_initializer_on_single_line = false
3333
resharper_show_autodetect_configure_formatting_tip = false

.github/workflows/build-dev.yml

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,16 @@ jobs:
1616
runs-on: windows-latest
1717

1818
steps:
19-
- name: Checkout
19+
-
20+
name: Checkout
2021
uses: actions/[email protected]
21-
- name: Run tests on Windows for all targets
22+
-
23+
name: Setup .NET
24+
uses: actions/[email protected]
25+
with:
26+
dotnet-version: '6.0'
27+
-
28+
name: Run tests on Windows for all targets
2229
run: dotnet test -c Release
2330

2431
nuget:
@@ -29,6 +36,11 @@ jobs:
2936
-
3037
name: Checkout
3138
uses: actions/[email protected]
39+
-
40+
name: Setup .NET
41+
uses: actions/[email protected]
42+
with:
43+
dotnet-version: '6.0'
3244
-
3345
name: Unshallow
3446
run: git fetch --prune --unshallow

.github/workflows/pull-request.yml

Lines changed: 14 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -7,22 +7,27 @@ jobs:
77
runs-on: windows-latest
88

99
steps:
10-
11-
- uses: actions/[email protected]
12-
- uses: actions/[email protected]
10+
-
11+
name: Checkout
12+
uses: actions/[email protected]
13+
-
14+
name: Setup .NET
15+
uses: actions/[email protected]
1316
with:
14-
dotnet-version: '5.0'
15-
16-
- name: Run tests
17+
dotnet-version: '6.0'
18+
-
19+
name: Run tests
1720
run: dotnet test -c Release
1821

1922
docs:
2023
runs-on: ubuntu-latest
2124

2225
steps:
23-
- uses: actions/[email protected]
24-
25-
- name: Vuepress
26+
-
27+
name: Checkout
28+
uses: actions/[email protected]
29+
-
30+
name: Build docs
2631
run: |
2732
yarn install
2833
yarn docs:build

src/Directory.Build.props

Lines changed: 39 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -1,38 +1,43 @@
11
<Project>
2-
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildProjectDirectory), 'RestSharp.sln'))\props\Common.props" />
3-
<PropertyGroup>
4-
<PackageIcon>restsharp.png</PackageIcon>
5-
<PackageLicenseExpression>Apache-2.0</PackageLicenseExpression>
6-
<PackageProjectUrl>https://restsharp.dev</PackageProjectUrl>
7-
<RepositoryUrl>https://github.com/restsharp/RestSharp.git</RepositoryUrl>
8-
<RepositoryType>git</RepositoryType>
9-
<Description>Simple REST and HTTP API Client</Description>
10-
<Authors>John Sheehan, Andrew Young, Alexey Zimarev and RestSharp community</Authors>
11-
<UpdateVersionProperties>true</UpdateVersionProperties>
12-
<PublishRepositoryUrl>true</PublishRepositoryUrl>
13-
<IncludeSymbols>true</IncludeSymbols>
14-
<SymbolPackageFormat>snupkg</SymbolPackageFormat>
15-
<MinVerSkip Condition="'$(Configuration)' == 'Debug'">true</MinVerSkip>
16-
<GenerateDocumentationFile>true</GenerateDocumentationFile>
17-
<NoWarn>$(NoWarn);1591</NoWarn>
18-
</PropertyGroup>
19-
20-
<ItemGroup>
21-
<PackageReference Include="Microsoft.SourceLink.GitHub" Version="1.0.0" PrivateAssets="All"/>
22-
<PackageReference Include="MinVer" Version="2.5.0" PrivateAssets="All"/>
23-
<PackageReference Include="JetBrains.Annotations" Version="2021.3.0" PrivateAssets="All"/>
24-
<PackageReference Include="Microsoft.NETFramework.ReferenceAssemblies" Version="1.0.2" PrivateAssets="All" />
25-
</ItemGroup>
26-
27-
<ItemGroup>
28-
<None Include="$(RepoRoot)\restsharp.png" Pack="true" PackagePath="\"/>
29-
<Using Remove="System.Net.Http"/>
30-
</ItemGroup>
31-
32-
<Target Name="CustomVersion" AfterTargets="MinVer">
2+
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildProjectDirectory), 'RestSharp.sln'))\props\Common.props"/>
333
<PropertyGroup>
34-
<FileVersion>$(MinVerMajor).$(MinVerMinor).$(MinVerPatch)</FileVersion>
35-
<AssemblyVersion>$(MinVerMajor).$(MinVerMinor).$(MinVerPatch)</AssemblyVersion>
4+
<PackageIcon>restsharp.png</PackageIcon>
5+
<PackageLicenseExpression>Apache-2.0</PackageLicenseExpression>
6+
<PackageProjectUrl>https://restsharp.dev</PackageProjectUrl>
7+
<RepositoryUrl>https://github.com/restsharp/RestSharp.git</RepositoryUrl>
8+
<RepositoryType>git</RepositoryType>
9+
<Description>Simple REST and HTTP API Client</Description>
10+
<Authors>John Sheehan, Andrew Young, Alexey Zimarev and RestSharp community</Authors>
11+
<UpdateVersionProperties>true</UpdateVersionProperties>
12+
<PublishRepositoryUrl>true</PublishRepositoryUrl>
13+
<IncludeSymbols>true</IncludeSymbols>
14+
<SymbolPackageFormat>snupkg</SymbolPackageFormat>
15+
<GenerateDocumentationFile>true</GenerateDocumentationFile>
16+
<NoWarn>$(NoWarn);1591</NoWarn>
17+
</PropertyGroup>
18+
<PropertyGroup Condition="'$(Configuration)' == 'Debug'">
19+
<MinVerSkip>true</MinVerSkip>
20+
<GenerateAssemblyInfo>false</GenerateAssemblyInfo>
3621
</PropertyGroup>
37-
</Target>
22+
23+
<ItemGroup>
24+
<PackageReference Include="Microsoft.SourceLink.GitHub" Version="1.0.0" PrivateAssets="All"/>
25+
<PackageReference Include="MinVer" Version="2.5.0" PrivateAssets="All"/>
26+
<PackageReference Include="JetBrains.Annotations" Version="2021.3.0" PrivateAssets="All"/>
27+
</ItemGroup>
28+
29+
<ItemGroup>
30+
<None Include="$(RepoRoot)\restsharp.png" Pack="true" PackagePath="\"/>
31+
<!-- <Using Remove="System.Net.Http"/>-->
32+
</ItemGroup>
33+
<ItemGroup Condition="'$(TargetFramework)' == 'net452'">
34+
<PackageReference Include="Microsoft.NETFramework.ReferenceAssemblies.net452" Version="1.0.2" PrivateAssets="All"/>
35+
</ItemGroup>
36+
37+
<Target Name="CustomVersion" AfterTargets="MinVer">
38+
<PropertyGroup>
39+
<FileVersion>$(MinVerMajor).$(MinVerMinor).$(MinVerPatch)</FileVersion>
40+
<AssemblyVersion>$(MinVerMajor).$(MinVerMinor).$(MinVerPatch)</AssemblyVersion>
41+
</PropertyGroup>
42+
</Target>
3843
</Project>

src/RestSharp.Serializers.NewtonsoftJson/RestSharp.Serializers.NewtonsoftJson.csproj

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,4 +8,7 @@
88
<ItemGroup>
99
<ProjectReference Include="..\RestSharp\RestSharp.csproj" />
1010
</ItemGroup>
11+
<ItemGroup>
12+
<Using Remove="System.Net.Http"/>
13+
</ItemGroup>
1114
</Project>

src/RestSharp.Serializers.SystemTextJson/RestSharp.Serializers.SystemTextJson.csproj

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,4 +8,7 @@
88
<ItemGroup>
99
<ProjectReference Include="..\RestSharp\RestSharp.csproj" />
1010
</ItemGroup>
11+
<ItemGroup>
12+
<Using Remove="System.Net.Http"/>
13+
</ItemGroup>
1114
</Project>

src/RestSharp.Serializers.Utf8Json/RestSharp.Serializers.Utf8Json.csproj

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,4 +8,7 @@
88
<ItemGroup>
99
<ProjectReference Include="..\RestSharp\RestSharp.csproj" />
1010
</ItemGroup>
11+
<ItemGroup>
12+
<Using Remove="System.Net.Http"/>
13+
</ItemGroup>
1114
</Project>

src/RestSharp/RestSharp.csproj

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,13 @@
22
<PropertyGroup>
33
<TargetFrameworks>netstandard2.0;net452</TargetFrameworks>
44
<TargetsForTfmSpecificBuildOutput>$(TargetsForTfmSpecificBuildOutput);CopyProjectReferencesToPackage</TargetsForTfmSpecificBuildOutput>
5-
<Nullable>enable</Nullable>
65
</PropertyGroup>
7-
<ItemGroup>
8-
<Reference Include="System.Web" Condition="'$(TargetFramework)' == 'net452'"/>
6+
<ItemGroup Condition="'$(TargetFramework)' == 'net452'">
7+
<Reference Include="System.Web"/>
8+
<Using Remove="System.Net.Http"/>
99
</ItemGroup>
1010
<ItemGroup>
1111
<None Remove="RestSharp.csproj.DotSettings"/>
12-
<Using Remove="System.Net.Http"/>
1312
</ItemGroup>
1413
<Target DependsOnTargets="ResolveReferences" Name="CopyProjectReferencesToPackage">
1514
<ItemGroup>

test/Directory.Build.props

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,16 +3,19 @@
33
<PropertyGroup>
44
<IsTestProject>true</IsTestProject>
55
<IsPackable>false</IsPackable>
6+
<Nullable>disable</Nullable>
67
</PropertyGroup>
78

89
<ItemGroup>
910
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.0.0"/>
1011
<PackageReference Include="xunit" Version="2.4.1"/>
1112
<PackageReference Include="xunit.runner.visualstudio" Version="2.4.3" PrivateAssets="All"/>
1213
<PackageReference Include="AutoFixture" Version="4.17.0"/>
13-
<PackageReference Include="FluentAssertions" Version="6.2.0"/>
14+
<PackageReference Include="FluentAssertions" Version="5.10.3"/>
1415
<PackageReference Include="coverlet.collector" Version="3.1.0"/>
15-
<PackageReference Include="Microsoft.NETFramework.ReferenceAssemblies" Version="1.0.2" PrivateAssets="All"/>
16+
</ItemGroup>
17+
<ItemGroup Condition="'$(TargetFramework)' == 'net452'">
18+
<PackageReference Include="Microsoft.NETFramework.ReferenceAssemblies.net452" Version="1.0.2" PrivateAssets="All"/>
1619
</ItemGroup>
1720

1821
<ItemGroup>
@@ -21,5 +24,6 @@
2124
<Using Include="FluentAssertions"/>
2225
<Using Include="FluentAssertions.Extensions"/>
2326
<Using Include="AutoFixture"/>
27+
<Using Remove="System.Net.Http"/>
2428
</ItemGroup>
2529
</Project>

test/RestSharp.IntegrationTests/AsyncRequestBodyTests.cs

Lines changed: 7 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,16 @@
11
using System.Net;
2+
using RestSharp.IntegrationTests.Fixtures;
23
using RestSharp.Tests.Shared.Fixtures;
34

4-
namespace RestSharp.IntegrationTests;
5+
namespace RestSharp.IntegrationTests;
56

67
public class AsyncRequestBodyTests {
7-
[OneTimeSetUp]
8-
public void Setup() => _server = SimpleServer.Create(Handlers.Generic<RequestBodyCapturer>());
9-
10-
[OneTimeTearDown]
11-
public void Teardown() => _server.Dispose();
12-
13-
[SetUp]
14-
public void CreateClient() => _client = new RestClient(_server.Url);
8+
public AsyncRequestBodyTests(RequestBodyFixture fixture) {
9+
var server = fixture.Server;
10+
_client = new RestClient(server.Url);
11+
}
1512

16-
SimpleServer _server;
17-
RestClient _client;
13+
readonly RestClient _client;
1814

1915
static void AssertHasNoRequestBody() {
2016
Assert.Null(RequestBodyCapturer.CapturedContentType);

0 commit comments

Comments
 (0)