Skip to content

Commit 4f13307

Browse files
committed
Update to .NET 6 SDK to build and netcoreapp3.1 for test
This requires a few nullable-reference-type overrides in tests where we're absolutely confident they won't be null (and if we're wrong, an NRE is fine to break the test). Signed-off-by: Jon Skeet <[email protected]>
1 parent 16fb2a2 commit 4f13307

File tree

9 files changed

+16
-26
lines changed

9 files changed

+16
-26
lines changed

.github/workflows/build.yml

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -17,22 +17,17 @@ jobs:
1717
- name: Check out our repo
1818
uses: actions/checkout@v2
1919

20-
# We need the .NET Core 2.1 and .NET Core 3.1 runtimes for testing
21-
- name: Setup .NET Core 2.1
22-
uses: actions/setup-dotnet@v1
23-
with:
24-
dotnet-version: 2.1.x
25-
20+
# We need the .NET Core 3.1 runtime for testing
2621
- name: Setup .NET Core 3.1
2722
uses: actions/setup-dotnet@v1
2823
with:
2924
dotnet-version: 3.1.x
3025

31-
# Build with .NET Core 5.0 SDK
32-
- name: Setup .NET Core 5.0
26+
# Build with .NET 6.0 SDK
27+
- name: Setup .NET 6.0
3328
uses: actions/setup-dotnet@v1
3429
with:
35-
dotnet-version: 5.0.x
30+
dotnet-version: 6.0.x
3631

3732
- name: Build
3833
run: |

.github/workflows/nuget.yml

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -15,22 +15,17 @@ jobs:
1515
- name: Check out our repo
1616
uses: actions/checkout@v2
1717

18-
# We need the .NET Core 2.1 and .NET Core 3.1 runtimes for testing
19-
- name: Setup .NET Core 2.1
20-
uses: actions/setup-dotnet@v1
21-
with:
22-
dotnet-version: 2.1.x
23-
18+
# We need the .NET Core 3.1 runtime for testing
2419
- name: Setup .NET Core 3.1
2520
uses: actions/setup-dotnet@v1
2621
with:
2722
dotnet-version: 3.1.x
2823

29-
# Build with .NET Core 5.0 SDK
30-
- name: Setup .NET Core 5.0
24+
# Build with .NET 6.0 SDK
25+
- name: Setup .NET 6.0
3126
uses: actions/setup-dotnet@v1
3227
with:
33-
dotnet-version: 5.0.x
28+
dotnet-version: 6.0.x
3429

3530
- name: Build
3631
run: |

samples/CloudNative.CloudEvents.AspNetCoreSample/CloudNative.CloudEvents.AspNetCoreSample.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<Project Sdk="Microsoft.NET.Sdk.Web">
22

33
<PropertyGroup>
4-
<TargetFrameworks>netcoreapp3.1;net50</TargetFrameworks>
4+
<TargetFrameworks>netcoreapp3.1;net6.0</TargetFrameworks>
55
</PropertyGroup>
66

77
<ItemGroup>

samples/HttpSend/HttpSend.csproj

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

33
<PropertyGroup>
44
<OutputType>Exe</OutputType>
5-
<TargetFramework>netcoreapp2.1</TargetFramework>
5+
<TargetFramework>netcoreapp3.1</TargetFramework>
66
</PropertyGroup>
77

88
<ItemGroup>

test/CloudNative.CloudEvents.UnitTests/CloudEventAttributeTest.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@ public void Validate_WithValidator_InvalidValue()
114114
var exception = Assert.Throws<ArgumentException>(() => attr.Validate(-5));
115115
Assert.Contains("Custom validation message", exception.Message);
116116
Assert.IsType<Exception>(exception.InnerException);
117-
Assert.Equal("Custom validation message", exception.InnerException.Message);
117+
Assert.Equal("Custom validation message", exception.InnerException!.Message);
118118
}
119119

120120
[Fact]

test/CloudNative.CloudEvents.UnitTests/CloudEventAttributeTypeTest.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,8 +43,8 @@ public void OrdinalTypeNameMatchesPropertyName()
4343
.Where(prop => prop.PropertyType == typeof(CloudEventAttributeType));
4444
foreach (var property in properties)
4545
{
46-
var type = (CloudEventAttributeType) property.GetValue(null);
47-
Assert.Equal(property.Name, type.Ordinal.ToString());
46+
var type = (CloudEventAttributeType) property.GetValue(null)!;
47+
Assert.Equal(property.Name, type!.Ordinal.ToString());
4848
}
4949
}
5050

test/CloudNative.CloudEvents.UnitTests/CloudEventTest.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ public void Invalid_ContentType_Throws()
6666
{
6767
var cloudEvent = new CloudEvent();
6868
var exception = Assert.Throws<ArgumentException>(() => cloudEvent.DataContentType = "text/html; charset:");
69-
Assert.StartsWith(Strings.ErrorContentTypeIsNotRFC2046, exception.InnerException.Message);
69+
Assert.StartsWith(Strings.ErrorContentTypeIsNotRFC2046, exception.InnerException!.Message);
7070
}
7171

7272
[Fact]

test/CloudNative.CloudEvents.UnitTests/CloudNative.CloudEvents.UnitTests.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<Project Sdk="Microsoft.NET.Sdk">
22

33
<PropertyGroup>
4-
<TargetFramework>netcoreapp2.1</TargetFramework>
4+
<TargetFramework>netcoreapp3.1</TargetFramework>
55
<LangVersion>8.0</LangVersion>
66
<Nullable>enable</Nullable>
77
</PropertyGroup>

test/CloudNative.CloudEvents.UnitTests/SystemTextJson/JsonEventFormatterTest.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -981,7 +981,7 @@ private static IReadOnlyList<CloudEvent> DecodeBatchModeMessage(Newtonsoft.Json.
981981
private class YearMonthDayConverter : JsonConverter<DateTime>
982982
{
983983
public override DateTime Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) =>
984-
DateTime.ParseExact(reader.GetString(), "yyyy-MM-dd", CultureInfo.InvariantCulture);
984+
DateTime.ParseExact(reader.GetString()!, "yyyy-MM-dd", CultureInfo.InvariantCulture);
985985

986986
public override void Write(Utf8JsonWriter writer, DateTime value, JsonSerializerOptions options) =>
987987
writer.WriteStringValue(value.ToString("yyyy-MM-dd", CultureInfo.InvariantCulture));

0 commit comments

Comments
 (0)