Skip to content

Commit fe20be0

Browse files
committed
Update to .NET 7
1 parent 11ea932 commit fe20be0

File tree

73 files changed

+41
-49
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

73 files changed

+41
-49
lines changed

00. Bare Minimum/Site.csproj

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<Project Sdk="Microsoft.NET.Sdk.Web">
22

33
<PropertyGroup>
4-
<TargetFramework>net6.0</TargetFramework>
4+
<TargetFramework>net7.0</TargetFramework>
55
<Nullable>enable</Nullable>
66
<ImplicitUsings>enable</ImplicitUsings>
77
</PropertyGroup>
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
<Project Sdk="Microsoft.NET.Sdk.Web">
22

33
<PropertyGroup>
4-
<TargetFramework>net6.0</TargetFramework>
4+
<TargetFramework>net7.0</TargetFramework>
55
<Nullable>enable</Nullable>
66
</PropertyGroup>
77

88
<ItemGroup>
9-
<PackageReference Include="Swashbuckle.AspNetCore" Version="6.2.3" />
9+
<PackageReference Include="Swashbuckle.AspNetCore" Version="6.4.0" />
1010
</ItemGroup>
1111

1212
</Project>
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

03. namespace/Site.csproj

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
<Project Sdk="Microsoft.NET.Sdk.Web">
22

33
<PropertyGroup>
4-
<TargetFramework>net6.0</TargetFramework>
4+
<TargetFramework>net7.0</TargetFramework>
55
<Nullable>enable</Nullable>
66
</PropertyGroup>
77

88
<ItemGroup>
9-
<PackageReference Include="Swashbuckle.AspNetCore" Version="6.2.3" />
9+
<PackageReference Include="Swashbuckle.AspNetCore" Version="6.4.0" />
1010
</ItemGroup>
1111

1212
</Project>

04. global usings/Site.csproj

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
<Project Sdk="Microsoft.NET.Sdk.Web">
22

33
<PropertyGroup>
4-
<TargetFramework>net6.0</TargetFramework>
4+
<TargetFramework>net7.0</TargetFramework>
55
<Nullable>enable</Nullable>
66
</PropertyGroup>
77

88
<ItemGroup>
9-
<PackageReference Include="Swashbuckle.AspNetCore" Version="6.2.3" />
9+
<PackageReference Include="Swashbuckle.AspNetCore" Version="6.4.0" />
1010
</ItemGroup>
1111

1212
</Project>
+2-2
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
<Project Sdk="Microsoft.NET.Sdk.Web">
22

33
<PropertyGroup>
4-
<TargetFramework>net6.0</TargetFramework>
4+
<TargetFramework>net7.0</TargetFramework>
55
<Nullable>enable</Nullable>
66
<ImplicitUsings>enable</ImplicitUsings>
77
</PropertyGroup>
88

99
<ItemGroup>
10-
<PackageReference Include="Swashbuckle.AspNetCore" Version="6.2.3" />
10+
<PackageReference Include="Swashbuckle.AspNetCore" Version="6.4.0" />
1111
</ItemGroup>
1212

1313
</Project>

06. new builder/Site.csproj

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
<Project Sdk="Microsoft.NET.Sdk.Web">
22

33
<PropertyGroup>
4-
<TargetFramework>net6.0</TargetFramework>
4+
<TargetFramework>net7.0</TargetFramework>
55
<Nullable>enable</Nullable>
66
<ImplicitUsings>enable</ImplicitUsings>
77
</PropertyGroup>
88

99
<ItemGroup>
10-
<PackageReference Include="Swashbuckle.AspNetCore" Version="6.2.3" />
10+
<PackageReference Include="Swashbuckle.AspNetCore" Version="6.4.0" />
1111
</ItemGroup>
1212

1313
</Project>

07. minimal apis/Site.csproj

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
<Project Sdk="Microsoft.NET.Sdk.Web">
22

33
<PropertyGroup>
4-
<TargetFramework>net6.0</TargetFramework>
4+
<TargetFramework>net7.0</TargetFramework>
55
<Nullable>enable</Nullable>
66
<ImplicitUsings>enable</ImplicitUsings>
77
</PropertyGroup>
88

99
<ItemGroup>
10-
<PackageReference Include="Swashbuckle.AspNetCore" Version="6.2.3" />
10+
<PackageReference Include="Swashbuckle.AspNetCore" Version="6.4.0" />
1111
</ItemGroup>
1212

1313
</Project>

08. more structure/Site.csproj

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
<Project Sdk="Microsoft.NET.Sdk.Web">
22

33
<PropertyGroup>
4-
<TargetFramework>net6.0</TargetFramework>
4+
<TargetFramework>net7.0</TargetFramework>
55
<Nullable>enable</Nullable>
66
<ImplicitUsings>enable</ImplicitUsings>
77
</PropertyGroup>
88

99
<ItemGroup>
10-
<PackageReference Include="Swashbuckle.AspNetCore" Version="6.2.3" />
10+
<PackageReference Include="Swashbuckle.AspNetCore" Version="6.4.0" />
1111
</ItemGroup>
1212

1313
</Project>

09. testing/Site.Tests/MinimalIntegrationTests.cs

+11-15
Original file line numberDiff line numberDiff line change
@@ -17,16 +17,14 @@ public async Task Get_SaysHello()
1717
// act
1818
using var res = await client.GetAsync("/api/minimal?name=test");
1919
var body = await res.Content.ReadAsStringAsync();
20-
MinimalModel? model = JsonSerializer.Deserialize<MinimalModel> (body, jsonOptions);
20+
MinimalModel? model = JsonSerializer.Deserialize<MinimalModel>(body, jsonOptions);
2121

2222
// assert
23-
using (new AssertionScope())
24-
{
25-
model.Should().NotBeNull();
26-
ArgumentNullException.ThrowIfNull(model);
27-
model.Id.Should().Be(3);
28-
model.Message.Should().Be("Hello test");
29-
}
23+
using var scope = new AssertionScope();
24+
model.Should().NotBeNull();
25+
ArgumentNullException.ThrowIfNull(model);
26+
model.Id.Should().Be(3);
27+
model.Message.Should().Be("Hello test");
3028
}
3129

3230
[Fact]
@@ -49,13 +47,11 @@ public async Task Post_SaysHello()
4947
MinimalModel? model = JsonSerializer.Deserialize<MinimalModel>(body, jsonOptions);
5048

5149
// assert
52-
using (new AssertionScope())
53-
{
54-
model.Should().NotBeNull();
55-
ArgumentNullException.ThrowIfNull(model);
56-
model.Message.Should().Be("Hello foo and 5");
57-
model.Data.Should().BeEquivalentTo(expected);
58-
}
50+
using var scope = new AssertionScope();
51+
model.Should().NotBeNull();
52+
ArgumentNullException.ThrowIfNull(model);
53+
model.Message.Should().Be("Hello foo and 5");
54+
model.Data.Should().BeEquivalentTo(expected);
5955
}
6056

6157
}

09. testing/Site.Tests/Site.Tests.csproj

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<Project Sdk="Microsoft.NET.Sdk">
22

33
<PropertyGroup>
4-
<TargetFramework>net6.0</TargetFramework>
4+
<TargetFramework>net7.0</TargetFramework>
55
<Nullable>enable</Nullable>
66
<ImplicitUsings>enable</ImplicitUsings>
77
<IsPackable>false</IsPackable>

09. testing/Site.Tests/WeatherIntegrationTests.cs

+4-6
Original file line numberDiff line numberDiff line change
@@ -7,19 +7,17 @@ public async Task Gets5Forecasts()
77
{
88
// arrange
99
await using var application = new SiteApp();
10-
using var client = application.CreateClient();
10+
using HttpClient client = application.CreateClient();
1111

1212
// act
1313
using var res = await client.GetAsync("/api/WeatherForecast");
1414
var body = await res.Content.ReadAsStringAsync();
1515
List<WeatherForecast>? weatherForecasts = JsonSerializer.Deserialize<List<WeatherForecast>>(body);
1616

1717
// assert
18-
using (new AssertionScope())
19-
{
20-
weatherForecasts.Should().NotBeNull();
21-
weatherForecasts.Should().HaveCount(5);
22-
}
18+
using var scope = new AssertionScope();
19+
weatherForecasts.Should().NotBeNull();
20+
weatherForecasts.Should().HaveCount(5);
2321
}
2422

2523
}

09. testing/Site.Tests/WeatherUnitTests.cs

+3-5
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,9 @@ public void Gets5Forecasts()
1313
IEnumerable<WeatherForecast> weatherForecasts = controller.Get();
1414

1515
// assert
16-
using (new AssertionScope())
17-
{
18-
weatherForecasts.Should().NotBeNull();
19-
weatherForecasts.Should().HaveCount(5);
20-
}
16+
using var scope = new AssertionScope();
17+
weatherForecasts.Should().NotBeNull();
18+
weatherForecasts.Should().HaveCount(5);
2119
}
2220

2321
}

09. testing/Site/Site.csproj

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
<Project Sdk="Microsoft.NET.Sdk.Web">
22

33
<PropertyGroup>
4-
<TargetFramework>net6.0</TargetFramework>
4+
<TargetFramework>net7.0</TargetFramework>
55
<Nullable>enable</Nullable>
66
<ImplicitUsings>enable</ImplicitUsings>
77
</PropertyGroup>
88

99
<ItemGroup>
10-
<PackageReference Include="Swashbuckle.AspNetCore" Version="6.2.3" />
10+
<PackageReference Include="Swashbuckle.AspNetCore" Version="6.4.0" />
1111
</ItemGroup>
1212

1313
</Project>

10. right size/Site.csproj

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
<Project Sdk="Microsoft.NET.Sdk.Web">
22

33
<PropertyGroup>
4-
<TargetFramework>net6.0</TargetFramework>
4+
<TargetFramework>net7.0</TargetFramework>
55
<Nullable>enable</Nullable>
66
<ImplicitUsings>enable</ImplicitUsings>
77
</PropertyGroup>
88

99
<ItemGroup>
10-
<PackageReference Include="Swashbuckle.AspNetCore" Version="6.2.3" />
10+
<PackageReference Include="Swashbuckle.AspNetCore" Version="6.4.0" />
1111
</ItemGroup>
1212

1313
<ItemGroup>

README.md

+3-3

0 commit comments

Comments
 (0)