Skip to content

Commit 0538b21

Browse files
authored
Prepare fore release 0.8 (#182)
* Added codeql pipeline Fixes #162 * Add .NET 7.0 support * Update nuget packages * Update version and release notes for v0.8 * Update README with supported .NET versions
1 parent 6e1dd27 commit 0538b21

31 files changed

+307
-113
lines changed

.config/dotnet-tools.json

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,6 @@
77
"commands": [
88
"dotnet-sonarscanner"
99
]
10-
},
11-
"nbgv": {
12-
"version": "3.5.113",
13-
"commands": [
14-
"nbgv"
15-
]
1610
}
1711
}
1812
}

.editorconfig

Lines changed: 34 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -19,70 +19,78 @@ dotnet_style_qualification_for_event = false:warning
1919
dotnet_style_predefined_type_for_locals_parameters_members = true:error
2020
dotnet_style_predefined_type_for_member_access = true:error
2121

22+
csharp_preferred_modifier_order=public,private,protected,internal,file,static,extern,new,virtual,abstract,sealed,override,readonly,unsafe,required,volatile,async:warning
2223
dotnet_style_require_accessibility_modifiers = always:error
2324
dotnet_style_readonly_field = true:warning
24-
csharp_preferred_modifier_order=public,private,protected,internal,static,extern,new,virtual,abstract,sealed,override,readonly,unsafe,volatile,async:warning
25+
csharp_prefer_static_local_function = true:warning
2526

2627
dotnet_style_parentheses_in_arithmetic_binary_operators = always_for_clarity:suggestion
2728
dotnet_style_parentheses_in_relational_binary_operators = always_for_clarity:suggestion
2829
dotnet_style_parentheses_in_other_binary_operators = always_for_clarity:suggestion
2930
dotnet_style_parentheses_in_other_operators = never_if_unnecessary:warning
3031

3132
dotnet_style_object_initializer = true:suggestion
33+
csharp_style_inlined_variable_declaration = true:warning
3234
dotnet_style_collection_initializer = true:suggestion
35+
dotnet_style_prefer_auto_properties = true:silent
3336
dotnet_style_explicit_tuple_names = true:suggestion
37+
csharp_prefer_simple_default_expression = true:warning
3438
dotnet_style_prefer_inferred_tuple_names = true:suggestion
3539
dotnet_style_prefer_inferred_anonymous_type_member_names = true:suggestion
36-
dotnet_style_prefer_auto_properties = true:silent
40+
csharp_style_prefer_local_over_anonymous_function = true:warning
41+
csharp_style_deconstructed_variable_declaration = true:suggestion
3742
dotnet_style_prefer_conditional_expression_over_assignment = true:suggestion
3843
dotnet_style_prefer_conditional_expression_over_return = false:suggestion
3944
dotnet_style_prefer_compound_assignment = true:suggestion
45+
csharp_style_prefer_index_operator = true:suggestion
46+
csharp_style_prefer_range_operator = true:suggestion
47+
dotnet_style_prefer_simplified_boolean_expressions = true:warning
48+
csharp_style_implicit_object_creation_when_type_is_apparent = true:warning
49+
csharp_style_prefer_tuple_swap = true:warning
4050

51+
csharp_style_namespace_declarations = file_scoped
52+
53+
csharp_style_throw_expression = true:suggestion
4154
dotnet_style_coalesce_expression = true:suggestion
4255
dotnet_style_null_propagation = true:suggestion
56+
dotnet_style_prefer_is_null_check_over_reference_equality_method = true:warning
57+
csharp_style_prefer_null_check_over_type_check = true:warning
58+
csharp_style_conditional_delegate_call = true:suggestion
4359

44-
dotnet_code_quality_unused_parameters = all:warning
45-
46-
csharp_style_var_for_built_in_types = true:suggestion
47-
csharp_style_var_when_type_is_apparent = true:suggestion
48-
csharp_style_var_elsewhere = true:suggestion
60+
csharp_style_var_for_built_in_types = false:suggestion
61+
csharp_style_var_when_type_is_apparent = false:suggestion
62+
csharp_style_var_elsewhere = false:suggestion
4963

50-
csharp_style_expression_bodied_methods = false:silent
5164
csharp_style_expression_bodied_constructors = false:silent
65+
csharp_style_expression_bodied_methods = false:silent
5266
csharp_style_expression_bodied_operators = false:silent
5367
csharp_style_expression_bodied_properties = true:suggestion
5468
csharp_style_expression_bodied_indexers = true:suggestion
5569
csharp_style_expression_bodied_accessors = true:suggestion
5670
csharp_style_expression_bodied_lambdas = true:silent
5771
csharp_style_expression_bodied_local_functions = false:silent
5872

59-
csharp_style_pattern_matching_over_is_with_cast_check = true:warning
6073
csharp_style_pattern_matching_over_as_with_null_check = true:warning
61-
62-
csharp_style_inlined_variable_declaration = true:warning
63-
64-
csharp_prefer_simple_default_expression = true:warning
65-
66-
csharp_style_throw_expression = true:suggestion
67-
csharp_style_conditional_delegate_call = true:suggestion
74+
csharp_style_pattern_matching_over_is_with_cast_check = true:warning
75+
csharp_style_prefer_switch_expression = true:warning
76+
csharp_style_prefer_pattern_matching = true:warning
77+
csharp_style_prefer_not_pattern = true:warning
78+
csharp_style_prefer_extended_property_pattern = true:warning
6879

6980
csharp_prefer_braces = true:warning
81+
csharp_prefer_simple_using_statement = true:warning
82+
csharp_using_directive_placement = outside_namespace:error
83+
84+
file_header_template = unset
7085

7186
csharp_style_unused_value_expression_statement_preference = discard_variable:suggestion
7287
csharp_style_unused_value_assignment_preference = discard_variable:suggestion
73-
74-
csharp_style_prefer_index_operator = true:suggestion
75-
csharp_style_prefer_range_operator = true:suggestion
76-
77-
csharp_style_deconstructed_variable_declaration = true:suggestion
78-
csharp_style_pattern_local_over_anonymous_function = true:suggestion
79-
csharp_using_directive_placement = outside_namespace:error
80-
csharp_prefer_static_local_function = true:suggestion
81-
csharp_prefer_simple_using_statement = true:warning
82-
csharp_style_prefer_switch_expression = true:suggestion
88+
dotnet_code_quality_unused_parameters = all:warning
89+
dotnet_remove_unnecessary_suppression_exclusions = all:warning
8390

8491
dotnet_sort_system_directives_first = true
8592
dotnet_separate_import_directive_groups = true
93+
dotnet_style_namespace_match_folder = true
8694

8795
# CA1303: Do not pass literals as localized parameters
8896
dotnet_diagnostic.CA1303.severity = silent

.github/workflows/ci.yml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ jobs:
2828
dotnet-version: |
2929
3.1.x
3030
6.0.x
31+
7.0.x
3132
- name: Dump .NET info
3233
run: dotnet --info
3334
- name: Restore dotnet tools
@@ -78,6 +79,7 @@ jobs:
7879
dotnet-version: |
7980
3.1
8081
6.0
82+
7.0
8183
- name: Dump .NET info
8284
run: dotnet --info
8385
- name: Restore dependencies
@@ -98,7 +100,7 @@ jobs:
98100
uses: actions/setup-dotnet@v1
99101
with:
100102
dotnet-version: |
101-
6.0
103+
7.0
102104
- uses: actions/download-artifact@v2
103105
with:
104106
name: artifacts

.github/workflows/codeql.yml

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
name: "CodeQL"
2+
3+
on:
4+
push:
5+
branches-ignore:
6+
- 'dependabot/**'
7+
pull_request:
8+
schedule:
9+
- cron: '0 8 * * 1'
10+
11+
jobs:
12+
analyze:
13+
name: Analyze
14+
runs-on: ubuntu-latest
15+
permissions:
16+
actions: read
17+
contents: read
18+
security-events: write
19+
20+
steps:
21+
- name: Checkout Repository
22+
uses: actions/checkout@v2
23+
- name: Fetch all history for all tags and branches
24+
run: git fetch --prune --unshallow
25+
- name: Setup .NET versions
26+
uses: actions/setup-dotnet@v1
27+
with:
28+
dotnet-version: |
29+
3.1
30+
6.0
31+
7.0
32+
- name: Initialize CodeQL
33+
uses: github/codeql-action/init@v2
34+
with:
35+
queries: security-and-quality
36+
languages: csharp
37+
- name: Build source code
38+
run: dotnet build --configuration Release
39+
- name: Perform CodeQL Analysis
40+
uses: github/codeql-action/analyze@v2

CHANGELOG.md

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ All notable changes to TestableHttpClient will be documented in this file.
44
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and
55
this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
66

7-
## [0.8] - Unplanned
7+
## [0.8] - 2022-11-08
88
### Deprecated
99
- `TestableHttpMessageHandler.SimulateTimeout` is deprecated, and can be replaced with `RespondWith(Responses.Timeout())`.
1010
- `TestableHttpMessageHandler.RespondWith(Func<HttpRequestMessage, HttpResponseMessage>)` had been deprecated, it's functionality is replaced by IResponse.
@@ -16,6 +16,7 @@ this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm
1616
### Added
1717
- `CreateClient` now accepts `DelegateHandlers` in order to chain Handlers. The InnerHandler property of each handler is set automatically and the `TestableHttpMessageHandler` is automatically set as the last handler. This is showcased with Polly in the integration tests.
1818
- Added support for .NET Framework 4.6.2, .NET Framework 4.7 and .NET Framework 4.8 by running the tests against these versions.
19+
- Added support for .NET 7
1920
- When validating requests, an `HttpRequestMessageAssertionException` will be thrown when the content of a request is disposed. This typically happens on .NET Framework when the runtime decides to use the older version of System.Net.Http.
2021
- Added several `Responses`, including `Delayed`, `Timeout`, `Configured`, `Sequenced`, `StatusCode` and `Json`. These responses can now be used inside the `RespondWith`.
2122
- Added the possibility to set and override the JsonSerializerOptions.
@@ -26,6 +27,7 @@ this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm
2627
- The `HttpRequestMessage` is always added to the response, which is now possible, since we no longer allow reusing responses.
2728
- Added `ConfigureAwait(false)` to all calls, since we now use async/await in the library.
2829
- The check on request uri is now case insensitive by default, when test url's that are case sensitive set the `ignoreCase` parameter to false.
30+
- The project has been moved to an organisation, so all the url's have been changed and an icon is added to the NuGet package.
2931

3032
## [0.7] - 2022-09-22
3133
### Changed
@@ -230,6 +232,7 @@ this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm
230232
- Automatically build project when pushing changes to github and when creating a pull request
231233
- Automatically deploy to NuGet when creating a tag in github
232234

235+
[0.8]: https://github.com/testablehttpclient/TestableHttpClient/compare/v0.7...v0.8
233236
[0.7]: https://github.com/testablehttpclient/TestableHttpClient/compare/v0.6...v0.7
234237
[0.6]: https://github.com/testablehttpclient/TestableHttpClient/compare/v0.5...v0.6
235238
[0.5]: https://github.com/testablehttpclient/TestableHttpClient/compare/v0.4...v0.5

Directory.Build.props

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,18 @@
11
<Project>
22
<PropertyGroup>
3-
<LangVersion>10.0</LangVersion>
3+
<LangVersion>11.0</LangVersion>
44
<Nullable>enable</Nullable>
55
<GeneratePackageOnBuild>false</GeneratePackageOnBuild>
66
<EnableNETAnalyzers>true</EnableNETAnalyzers>
77
<AnalysisMode>AllEnabledByDefault</AnalysisMode>
8+
9+
<IsTestProject>$(MSBuildProjectName.EndsWith('Tests'))</IsTestProject>
810
</PropertyGroup>
911

10-
<PropertyGroup>
12+
<PropertyGroup Condition="'$(IsTestProject)' == 'false'">
1113
<Version>0.0.1</Version>
1214
<Authors>David Perfors</Authors>
13-
<Copyright>Copyright (c) 2020 David Perfors</Copyright>
15+
<Copyright>Copyright (c) 2022 David Perfors</Copyright>
1416
<PackageRequireLicenseAcceptance>false</PackageRequireLicenseAcceptance>
1517
<DevelopmentDependency>false</DevelopmentDependency>
1618
<PackageLicenseExpression>MIT</PackageLicenseExpression>
@@ -29,7 +31,7 @@
2931
<RepositoryType>git</RepositoryType>
3032
</PropertyGroup>
3133

32-
<ItemGroup>
34+
<ItemGroup Condition="'$(IsTestProject)' == 'false'">
3335
<None Include="$(MSBuildThisFileDirectory)/images/icon.png" Pack="true" PackagePath="" />
3436
<None Include="$(MSBuildThisFileDirectory)/LICENSE.md" Pack="true" PackagePath="" />
3537
<None Include="$(MSBuildProjectDirectory)/README.md" Pack="true" PackagePath="" />

Directory.Build.targets

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<Project>
22
<ItemGroup>
33
<PackageReference Include="Microsoft.SourceLink.GitHub" Version="1.1.1" PrivateAssets="All"/>
4-
<PackageReference Include="Nerdbank.GitVersioning" Version="3.5.113" PrivateAssets="All"/>
4+
<PackageReference Include="Nerdbank.GitVersioning" Version="3.5.119" PrivateAssets="All"/>
55
</ItemGroup>
66
</Project>

README.md

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# TestableHttpClient
22

3-
![GitHub](https://img.shields.io/github/license/testablehttpclient/TestableHttpClient) ![GitHub Workflow Status](https://img.shields.io/github/workflow/status/testablehttpclient/TestableHttpClient/ci)
3+
![GitHub](https://img.shields.io/github/license/testablehttpclient/TestableHttpClient) ![GitHub Workflow Status](https://img.shields.io/github/workflow/status/testablehttpclient/TestableHttpClient/CI)
44

55
Using HttpClient in code that is unit tested is seen as rather difficult, these libraries aims to make it easier to assert the calls that are made via an HttpClient and to make assertions on the HttpResponseMessages.
66

@@ -57,10 +57,12 @@ Check.That(testHandler).HasMadeRequestsTo("https://httpbin.org/*");
5757
## Supported .NET versions
5858

5959
TestableHttpClient is build as a netstandard2.0 library, so theoretically it can work on every .NET version that support netstandard2.0.
60-
However, only the following versions are being actively tested and thus supported:
60+
The following versions are being actively tested and thus supported:
6161

62+
- .NET Framework 4.6 and up
6263
- .NET Core 3.1
6364
- .NET 6.0
65+
- .NET 7.0
6466

6567
These versions are supported as long as Microsoft supports them, we do our best to test and support newer versions as soon as possible.
6668

global.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"sdk": {
3-
"version": "6.0.203",
3+
"version": "7.0.100",
44
"allowPrerelease": false,
55
"rollForward": "latestMajor"
66
}

src/TestableHttpClient.NFluent/FluentHttpRequestMessagesChecks.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
internal class FluentHttpRequestMessagesChecks : FluentSut<IEnumerable<HttpRequestMessage>>, IHttpRequestMessagesCheck
77
{
88
private IEnumerable<HttpRequestMessage> requests;
9-
private readonly List<string> requestConditions = new List<string>();
9+
private readonly List<string> requestConditions = new();
1010

1111
public FluentHttpRequestMessagesChecks(IEnumerable<HttpRequestMessage> httpRequestMessages, TestableHttpMessageHandlerOptions? options = null)
1212
: base(httpRequestMessages, Check.Reporter, false)

0 commit comments

Comments
 (0)