Skip to content

Commit d943791

Browse files
authored
Upgrade to .NET 6.0 (#348)
1 parent fd4c9e7 commit d943791

35 files changed

Lines changed: 583 additions & 582 deletions

File tree

.gitignore

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -337,3 +337,8 @@ coverage.cobertura.xml
337337

338338
# Specflow generated files
339339
*.feature.cs
340+
341+
# Scripted build migration
342+
*.sbom.*
343+
_codeCoverage/
344+
_packages/

GitVersion.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,5 +20,5 @@ branches:
2020
- feature
2121
- support
2222
- hotfix
23-
next-version: "1.6"
23+
next-version: "2.0"
2424

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55

66
This provides a library of useful testing extensions, primarily focussed on SpecFlow operations.
77

8-
It is built for netstandard2.0.
8+
It is built for .NET 6.0. (If you require .NET Standard 2.0, use `Corvus.Testing` v1.)
99

1010
The SpecFlow specific libraries contain additional bindings; to use these, you will need to add a `specflow.json` file to any project wishing to use them. Add entries to the `stepAssemblies` array for each of the Corvus libraries you need to use:
1111

Solutions/Corvus.Testing.AzureFunctions.DemoFunction/Corvus.Testing.AzureFunctions.DemoFunction.csproj

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
<Import Project="$(EndjinProjectPropsPath)" Condition="$(EndjinProjectPropsPath) != ''" />
44

55
<PropertyGroup>
6-
<TargetFramework>netcoreapp3.1</TargetFramework>
6+
<TargetFramework>net6.0</TargetFramework>
77
<Nullable>enable</Nullable>
88
<AzureFunctionsVersion>v3</AzureFunctionsVersion>
99
<IsPackable>false</IsPackable>
@@ -38,7 +38,7 @@
3838
<PrivateAssets>all</PrivateAssets>
3939
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
4040
</PackageReference>
41-
<PackageReference Include="Microsoft.NET.Sdk.Functions" Version="3.1.2" />
41+
<PackageReference Include="Microsoft.NET.Sdk.Functions" Version="4.1.3" />
4242
</ItemGroup>
4343
<ItemGroup>
4444
<None Update="host.json">

Solutions/Corvus.Testing.AzureFunctions.DemoFunction/SampleFunction.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ public async Task<IActionResult> SampleGetHandler(
5050
string? name = req.Query["name"];
5151

5252
string requestBody = await new StreamReader(req.Body).ReadToEndAsync().ConfigureAwait(false);
53-
dynamic data = JsonConvert.DeserializeObject(requestBody);
53+
dynamic data = JsonConvert.DeserializeObject(requestBody)!;
5454
name ??= data?.name;
5555

5656
string result = this.message.Replace("{name}", name);

Solutions/Corvus.Testing.AzureFunctions.DemoFunction/packages.lock.json

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,36 +1,36 @@
11
{
22
"version": 1,
33
"dependencies": {
4-
".NETCoreApp,Version=v3.1": {
4+
"net6.0": {
55
"Endjin.RecommendedPractices.GitHub": {
66
"type": "Direct",
7-
"requested": "[2.1.2, )",
8-
"resolved": "2.1.2",
9-
"contentHash": "mBUCmeSdWWrIQKuuYd9zflcwupRDmpF39dsbb07e6azlNIQqaE1J5TQa17c3SFVRXn9IZrClsmKoMporRTAWwQ==",
7+
"requested": "[2.1.4, )",
8+
"resolved": "2.1.4",
9+
"contentHash": "SUBvnwWuKtklIv9NWqY9PI/J1nONyvcOlitIhUTq5Hk8K0QnBoISc1xTZTe0C0tOtUW1JIAZeEYwAAeuzQwtYg==",
1010
"dependencies": {
11-
"Endjin.RecommendedPractices": "2.1.2",
11+
"Endjin.RecommendedPractices": "2.1.4",
1212
"Microsoft.SourceLink.GitHub": "1.1.1"
1313
}
1414
},
1515
"Microsoft.NET.Sdk.Functions": {
1616
"type": "Direct",
17-
"requested": "[3.1.2, )",
18-
"resolved": "3.1.2",
19-
"contentHash": "uupQ/kuN9MouX1imCa1PchL+2Heg0DtyQI5l0FdOEbYrWT27rwC5bao5a270KoEahDiLH0fLVRVs7WX2QKLUww==",
17+
"requested": "[4.1.3, )",
18+
"resolved": "4.1.3",
19+
"contentHash": "vpIoJxjvesBn7YOTDLLajYzlpu0DnuhV3qK+phPJ3Ywv62RwWdvqruFvZ2NtoUU8/Ad32mdhYWC3PcpuWPuyZw==",
2020
"dependencies": {
2121
"Microsoft.Azure.Functions.Analyzers": "[1.0.0, 2.0.0)",
2222
"Microsoft.Azure.WebJobs": "[3.0.32, 3.1.0)",
2323
"Microsoft.Azure.WebJobs.Extensions": "3.0.6",
2424
"Microsoft.Azure.WebJobs.Extensions.Http": "[3.2.0, 3.3.0)",
25-
"Microsoft.Azure.WebJobs.Script.ExtensionsMetadataGenerator": "1.2.2",
26-
"Newtonsoft.Json": "11.0.2"
25+
"Microsoft.Azure.WebJobs.Script.ExtensionsMetadataGenerator": "4.0.1",
26+
"Newtonsoft.Json": "13.0.1"
2727
}
2828
},
2929
"Roslynator.Analyzers": {
3030
"type": "Direct",
31-
"requested": "[4.1.1, )",
32-
"resolved": "4.1.1",
33-
"contentHash": "3cPVlrB1PytlO1ztZZBOExDKQWpMZgI15ZDa0BqLu0l6xv+xIRfEpqjNRcpvUy3aLxWTkPgSKZbbaO+VoFEJ1g=="
31+
"requested": "[4.2.0, )",
32+
"resolved": "4.2.0",
33+
"contentHash": "3N8CNx1Q/Q5VDDL7qgfZRgTURyMqzHAkAB59AZKRnsOXoh2n9xRzhiBMIbJaUtBATmieECBx68GcjRn2xoNDug=="
3434
},
3535
"StyleCop.Analyzers": {
3636
"type": "Direct",
@@ -43,8 +43,8 @@
4343
},
4444
"Endjin.RecommendedPractices": {
4545
"type": "Transitive",
46-
"resolved": "2.1.2",
47-
"contentHash": "Nbj0WS3zVDD2wjfU2/nbkWIWS9Ljg8VN+SSpaCuf5lHBOIEb0Ra201lGcyJHtRHybAciz+hQA9lHj7TnG52qqw==",
46+
"resolved": "2.1.4",
47+
"contentHash": "3B8zpRU3LEwHNZvEU8NHhzFZKZDpVaI4sMhv8bXcEoLQhRvJiBKQ90hibZIz7veX1Zi9PXrsH11HzdZBQMmntQ==",
4848
"dependencies": {
4949
"Microsoft.Build.Tasks.Git": "1.1.1"
5050
}
@@ -319,8 +319,8 @@
319319
},
320320
"Microsoft.Azure.WebJobs.Script.ExtensionsMetadataGenerator": {
321321
"type": "Transitive",
322-
"resolved": "1.2.2",
323-
"contentHash": "vpiNt3JM1pt/WrDIkg7G2DHhIpI4t5I+R9rmXCxIGiby5oPGEolyfiYZdEf2kMMN3SbWzVAbk4Q3jKgFhO9MaQ==",
322+
"resolved": "4.0.1",
323+
"contentHash": "o1E0hetLv8Ix0teA1hGH9D136RGSs24Njm5+a4FKzJHLlxfclvmOxmcg87vcr6LIszKzenNKd1oJGnOwg2WMnw==",
324324
"dependencies": {
325325
"System.Runtime.Loader": "4.3.0"
326326
}
@@ -640,8 +640,8 @@
640640
},
641641
"Newtonsoft.Json": {
642642
"type": "Transitive",
643-
"resolved": "11.0.2",
644-
"contentHash": "IvJe1pj7JHEsP8B8J8DwlMEx8UInrs/x+9oVY+oCD13jpLu4JbJU2WCIsMRn5C4yW9+DgkaO8uiVE5VHKjpmdQ=="
643+
"resolved": "13.0.1",
644+
"contentHash": "ppPFpBcvxdsfUonNcvITKqLl3bqxWbDCZIzDWHzjpdAHRFfZe0Dw9HmA0+za13IdyrgJwpkDTDA9fHaxOrt20A=="
645645
},
646646
"Newtonsoft.Json.Bson": {
647647
"type": "Transitive",

Solutions/Corvus.Testing.AzureFunctions.SpecFlow.Demo/AzureFunctionsTesting/DemoFunctionPerFeatureHooks.cs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,13 @@
44

55
namespace Corvus.Testing.SpecFlow.Demo.AzureFunctionsTesting
66
{
7-
using System;
87
using System.Threading.Tasks;
8+
99
using Corvus.Testing.AzureFunctions;
1010
using Corvus.Testing.AzureFunctions.SpecFlow;
11+
1112
using Microsoft.Extensions.Logging;
13+
1214
using TechTalk.SpecFlow;
1315

1416
[Binding]
@@ -23,7 +25,7 @@ public static Task StartFunctionsAsync(FeatureContext featureContext)
2325
return functionsController.StartFunctionsInstance(
2426
"Corvus.Testing.AzureFunctions.DemoFunction",
2527
7075,
26-
"netcoreapp3.1",
28+
"net6.0",
2729
configuration: functionConfiguration);
2830
}
2931

Solutions/Corvus.Testing.AzureFunctions.SpecFlow.Demo/AzureFunctionsTesting/DemoFunctionPerScenarioHooks.cs

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,39 +4,40 @@
44

55
namespace Corvus.Testing.SpecFlow.Demo.AzureFunctionsTesting
66
{
7-
using System;
87
using System.Threading.Tasks;
8+
99
using Corvus.Testing.AzureFunctions;
1010
using Corvus.Testing.AzureFunctions.SpecFlow;
11+
1112
using TechTalk.SpecFlow;
1213

1314
[Binding]
14-
public class DemoFunctionPerScenarioHooks
15+
public static class DemoFunctionPerScenarioHooks
1516
{
1617
[BeforeScenario("usingDemoFunctionPerScenario")]
17-
public Task StartFunctionsAsync(ScenarioContext scenarioContext)
18+
public static Task StartFunctionsAsync(ScenarioContext scenarioContext)
1819
{
1920
FunctionsController functionsController = FunctionsBindings.GetFunctionsController(scenarioContext);
2021
FunctionConfiguration functionConfiguration = FunctionsBindings.GetFunctionConfiguration(scenarioContext);
2122

2223
return functionsController.StartFunctionsInstance(
2324
"Corvus.Testing.AzureFunctions.DemoFunction",
2425
7075,
25-
"netcoreapp3.1",
26+
"net6.0",
2627
configuration: functionConfiguration);
2728
}
2829

2930
[BeforeScenario("usingDemoFunctionPerScenarioWithAdditionalConfiguration")]
30-
public Task StartFunctionWithAdditionalConfigurationAsync(ScenarioContext scenarioContext)
31+
public static Task StartFunctionWithAdditionalConfigurationAsync(ScenarioContext scenarioContext)
3132
{
3233
FunctionConfiguration functionConfiguration = FunctionsBindings.GetFunctionConfiguration(scenarioContext);
3334
functionConfiguration.EnvironmentVariables.Add("ResponseMessage", "Welcome, {name}");
3435

35-
return this.StartFunctionsAsync(scenarioContext);
36+
return StartFunctionsAsync(scenarioContext);
3637
}
3738

3839
[AfterScenario("usingDemoFunctionPerScenario", "usingDemoFunctionPerScenarioWithAdditionalConfiguration")]
39-
public void StopFunction(ScenarioContext scenarioContext)
40+
public static void StopFunction(ScenarioContext scenarioContext)
4041
{
4142
FunctionsController functionsController = FunctionsBindings.GetFunctionsController(scenarioContext);
4243
functionsController.TeardownFunctions();

Solutions/Corvus.Testing.AzureFunctions.SpecFlow.Demo/AzureFunctionsTesting/ScenariosUsingStepBindings.feature

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,48 +4,48 @@
44
I want to be able to start an Azure function from a step in my Scenario
55

66
Scenario: A Get request including a name in the querystring is successful
7-
Given I start a functions instance for the local project 'Corvus.Testing.AzureFunctions.DemoFunction' on port 7075 with runtime 'netcoreapp3.1'
7+
Given I start a functions instance for the local project 'Corvus.Testing.AzureFunctions.DemoFunction' on port 7075 with runtime 'net6.0'
88
When I send a GET request to 'http://localhost:7075/?name=Jon'
99
Then I receive a 200 response code
1010
And the response body contains the text 'Hello, Jon'
1111

1212
Scenario: A Get request without providing a name in the querystring fails.
13-
Given I start a functions instance for the local project 'Corvus.Testing.AzureFunctions.DemoFunction' on port 7075 with runtime 'netcoreapp3.1'
13+
Given I start a functions instance for the local project 'Corvus.Testing.AzureFunctions.DemoFunction' on port 7075 with runtime 'net6.0'
1414
When I send a GET request to 'http://localhost:7075/'
1515
Then I receive a 400 response code
1616

1717
Scenario: A Post request including a name in the querystring is successful
18-
Given I start a functions instance for the local project 'Corvus.Testing.AzureFunctions.DemoFunction' on port 7075 with runtime 'netcoreapp3.1'
18+
Given I start a functions instance for the local project 'Corvus.Testing.AzureFunctions.DemoFunction' on port 7075 with runtime 'net6.0'
1919
When I send a POST request to 'http://localhost:7075/?name=Jon'
2020
Then I receive a 200 response code
2121
And the response body contains the text 'Hello, Jon'
2222

2323
Scenario: A Post request including a name in the request body is successful
24-
Given I start a functions instance for the local project 'Corvus.Testing.AzureFunctions.DemoFunction' on port 7075 with runtime 'netcoreapp3.1'
24+
Given I start a functions instance for the local project 'Corvus.Testing.AzureFunctions.DemoFunction' on port 7075 with runtime 'net6.0'
2525
When I send a POST request to 'http://localhost:7075/' with data in the request body
2626
| PropertyName | Value |
2727
| name | Jon |
2828
Then I receive a 200 response code
2929
And the response body contains the text 'Hello, Jon'
3030

3131
Scenario: A Post request including names in the querystring and request body uses the name in the querystring
32-
Given I start a functions instance for the local project 'Corvus.Testing.AzureFunctions.DemoFunction' on port 7075 with runtime 'netcoreapp3.1'
32+
Given I start a functions instance for the local project 'Corvus.Testing.AzureFunctions.DemoFunction' on port 7075 with runtime 'net6.0'
3333
When I send a POST request to 'http://localhost:7075/?name=Jon' with data in the request body
3434
| PropertyName | Value |
3535
| name | Jonathan |
3636
Then I receive a 200 response code
3737
And the response body contains the text 'Hello, Jon'
3838

3939
Scenario: A Post request without a querystring or request body fails
40-
Given I start a functions instance for the local project 'Corvus.Testing.AzureFunctions.DemoFunction' on port 7075 with runtime 'netcoreapp3.1'
40+
Given I start a functions instance for the local project 'Corvus.Testing.AzureFunctions.DemoFunction' on port 7075 with runtime 'net6.0'
4141
When I send a POST request to 'http://localhost:7075/'
4242
Then I receive a 400 response code
4343

4444
Scenario: Supplying an alternative greeting via configuration
4545
Given I have set additional configuration for functions instances
4646
| Key | Value |
4747
| ResponseMessage | Welcome, {name} |
48-
And I start a functions instance for the local project 'Corvus.Testing.AzureFunctions.DemoFunction' on port 7075 with runtime 'netcoreapp3.1'
48+
And I start a functions instance for the local project 'Corvus.Testing.AzureFunctions.DemoFunction' on port 7075 with runtime 'net6.0'
4949
When I send a GET request to 'http://localhost:7075/?name=Jon'
5050
Then I receive a 200 response code
5151
And the response body contains the text 'Welcome, Jon'

Solutions/Corvus.Testing.AzureFunctions.SpecFlow.Demo/Corvus.Testing.AzureFunctions.SpecFlow.Demo.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
<Import Project="$(EndjinProjectPropsPath)" Condition="$(EndjinProjectPropsPath) != ''" />
44

55
<PropertyGroup>
6-
<TargetFramework>netcoreapp3.1</TargetFramework>
6+
<TargetFramework>net6.0</TargetFramework>
77
<Copyright>Copyright (c) Endjin Limited 2022. All rights reserved.</Copyright>
88
<LangVersion>latest</LangVersion>
99
<!-- Disabling SA1204 because it prioritizes static/non-static over public/non-public, which doesn't fit very well

0 commit comments

Comments
 (0)