Skip to content

Commit

Permalink
feat: Added support for net9.0 (#1404)
Browse files Browse the repository at this point in the history
* feat: Added support for net9.0

* ci: include .net 9 sdk in workflow

* chore: replace verfication file reference in solution with ci.

* note about .net 9 support in v1

---------

Co-authored-by: Egil Hansen <egil@assimilated.dk>
  • Loading branch information
linkdotnet and egil authored Mar 2, 2024
1 parent 80a8010 commit b859378
Show file tree
Hide file tree
Showing 20 changed files with 65 additions and 21 deletions.
3 changes: 3 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ jobs:
6.0.x
7.0.x
8.0.x
9.0.x
- name: ⚙️ Setup GIT versioning
uses: dotnet/nbgv@v0.4.2
Expand Down Expand Up @@ -132,6 +133,7 @@ jobs:
6.0.x
7.0.x
8.0.x
9.0.x
- name: 🧪 Run unit tests
run: dotnet test -c release --blame --blame-crash --blame-hang
Expand Down Expand Up @@ -209,6 +211,7 @@ jobs:
6.0.x
7.0.x
8.0.x
9.0.x
- name: ⚙️ Setup GIT versioning
uses: dotnet/nbgv@v0.4.2
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/docs-deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@ jobs:
6.0.x
7.0.x
8.0.x
9.0.x
- name: 🎨 Setup color
run: |
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ jobs:
6.0.x
7.0.x
8.0.x
9.0.x
- name: 🛠️ Update changelog
uses: thomaseizinger/keep-a-changelog-new-release@2.0.0
Expand Down
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ All notable changes to **bUnit** will be documented in this file. The project ad

### Added
- Support for `IKeyedServiceProvider` in net8.0. Reported by [@ViRuSTriNiTy](https://github.com/ViRuSTriNiTy). By [@linkdotnet](https://github.com/linkdotnet).
- Support for `net9.0`. NOTE, there is no commitment as of now to support net9.0 in bUnit v1. However. Support for net9.0 may move to a future v2 release of bUnit and be deprecated in v1. However, allowing bUnit to build and work with net9.0 previews allows our users to keep testing!

### Fixed
- Support for `SupplyFromQueryParameter` in net8.0. Reported by [@aayjaychan](https://github.com/aayjaychan). Fixed by [@egil](https://github.com/egil) and [@linkdotnet](https://github.com/linkdotnet).
Expand Down
1 change: 1 addition & 0 deletions Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
<DotNet6Version>6.0.*</DotNet6Version>
<DotNet7Version>7.0.*</DotNet7Version>
<DotNet8Version>8.0.*</DotNet8Version>
<DotNet9Version>9.0.0-*</DotNet9Version>
</PropertyGroup>

<!-- Solution wide properties -->
Expand Down
4 changes: 2 additions & 2 deletions bunit.sln
Original file line number Diff line number Diff line change
Expand Up @@ -48,11 +48,11 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "bunit.testassets", "tests\b
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = ".workflows", ".workflows", "{3B2F3419-5336-4147-A212-E19091195203}"
ProjectSection(SolutionItems) = preProject
.github\workflows\ci.yml = .github\workflows\ci.yml
.github\workflows\docs-deploy.yml = .github\workflows\docs-deploy.yml
.github\workflows\prepare-release.yml = .github\workflows\prepare-release.yml
.github\workflows\release-preview.yml = .github\workflows\release-preview.yml
.github\workflows\release.yml = .github\workflows\release.yml
.github\workflows\verification.yml = .github\workflows\verification.yml
EndProjectSection
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "benchmark", "benchmark", "{F6084D31-2A92-4794-A47E-A8F2254E6970}"
Expand All @@ -72,7 +72,7 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "bunit.generators.internal",
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "bunit.generators.tests", "tests\bunit.generators.tests\bunit.generators.tests.csproj", "{09046981-D9EC-4295-8502-721AC54E1F12}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "bunit.generators", "src\bunit.generators\bunit.generators.csproj", "{A7C6A2AA-FF8F-4ED1-8590-5324FC566059}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "bunit.generators", "src\bunit.generators\bunit.generators.csproj", "{A7C6A2AA-FF8F-4ED1-8590-5324FC566059}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Expand Down
2 changes: 1 addition & 1 deletion global.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"sdk": {
"rollForward": "latestMajor",
"allowPrerelease": false
"allowPrerelease": true
}
}
12 changes: 9 additions & 3 deletions src/bunit.core/bunit.core.csproj
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFrameworks>netstandard2.1;net5.0;net6.0;net7.0;net8.0</TargetFrameworks>
<TargetFrameworks>netstandard2.1;net5.0;net6.0;net7.0;net8.0;net9.0</TargetFrameworks>
<RootNamespace>Bunit</RootNamespace>
<AssemblyName>Bunit.Core</AssemblyName>
</PropertyGroup>

<PropertyGroup>
<PackageId>bunit.core</PackageId>
<Title>bUnit.core</Title>
Expand Down Expand Up @@ -44,4 +44,10 @@
<PackageReference Include="Microsoft.AspNetCore.Components" Version="$(DotNet8Version)" />
</ItemGroup>

</Project>
<ItemGroup Condition="'$(TargetFramework)' == 'net9.0'">
<PackageReference Include="Microsoft.Extensions.Logging" Version="$(DotNet9Version)" />
<PackageReference Include="Microsoft.Extensions.Logging.Abstractions" Version="$(DotNet9Version)" />
<PackageReference Include="Microsoft.AspNetCore.Components" Version="$(DotNet9Version)" />
</ItemGroup>

</Project>
10 changes: 8 additions & 2 deletions src/bunit.web.query/bunit.web.query.csproj
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFrameworks>netstandard2.1;net5.0;net6.0;net7.0;net8.0</TargetFrameworks>
<TargetFrameworks>netstandard2.1;net5.0;net6.0;net7.0;net8.0;net9.0</TargetFrameworks>
<RootNamespace>Bunit</RootNamespace>
<AssemblyName>Bunit.Web.Query</AssemblyName>
</PropertyGroup>
Expand Down Expand Up @@ -44,4 +44,10 @@
<PackageReference Include="Microsoft.AspNetCore.Components" Version="$(DotNet8Version)" />
</ItemGroup>

</Project>
<ItemGroup Condition="'$(TargetFramework)' == 'net9.0'">
<PackageReference Include="Microsoft.Extensions.Logging" Version="$(DotNet9Version)" />
<PackageReference Include="Microsoft.Extensions.Logging.Abstractions" Version="$(DotNet9Version)" />
<PackageReference Include="Microsoft.AspNetCore.Components" Version="$(DotNet9Version)" />
</ItemGroup>

</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,10 @@
namespace Bunit;

[SuppressMessage("Minor Code Smell", "S1939:Inheritance list should not be redundant", Justification = "By design. To make it obvious that both is implemented.")]
internal sealed class BunitJSObjectReference : IJSObjectReference, IJSInProcessObjectReference, IJSUnmarshalledObjectReference
internal sealed class BunitJSObjectReference : IJSObjectReference, IJSInProcessObjectReference
#if !NET9_0_OR_GREATER
, IJSUnmarshalledObjectReference
#endif
{
private BunitJSInterop JSInterop { get; }

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#if NET5_0_OR_GREATER
#if NET5_0_OR_GREATER && !NET9_0_OR_GREATER
using System;
using Bunit.JSInterop.Implementation;
using Microsoft.JSInterop;
Expand Down
1 change: 1 addition & 0 deletions src/bunit.web/JSInterop/JSRuntimeInvocation.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ namespace Bunit;
/// <summary>
/// Represents an invocation of JavaScript via the JSRuntime Mock.
/// </summary>
[Serializable]
public readonly struct JSRuntimeInvocation : IEquatable<JSRuntimeInvocation>
{
/// <summary>
Expand Down
13 changes: 12 additions & 1 deletion src/bunit.web/bunit.web.csproj
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFrameworks>netstandard2.1;net5.0;net6.0;net7.0;net8.0</TargetFrameworks>
<TargetFrameworks>netstandard2.1;net5.0;net6.0;net7.0;net8.0;net9.0</TargetFrameworks>
<RootNamespace>Bunit</RootNamespace>
<AssemblyName>Bunit.Web</AssemblyName>
<!--
Expand Down Expand Up @@ -76,6 +76,17 @@
<PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly.Authentication" Version="$(DotNet8Version)" />
</ItemGroup>

<ItemGroup Condition="'$(TargetFramework)' == 'net9.0'">
<PackageReference Include="AngleSharp" Version="1.1.0" />
<PackageReference Include="AngleSharp.Css" Version="1.0.0-beta.139" />
<PackageReference Include="Microsoft.AspNetCore.Components.Authorization" Version="$(DotNet9Version)" />
<PackageReference Include="Microsoft.Extensions.Localization.Abstractions" Version="$(DotNet9Version)" />
<PackageReference Include="Microsoft.Extensions.Caching.Memory" Version="$(DotNet9Version)" />
<PackageReference Include="Microsoft.AspNetCore.Components.Web" Version="$(DotNet9Version)" />
<PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly" Version="$(DotNet9Version)" />
<PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly.Authentication" Version="$(DotNet9Version)" />
</ItemGroup>

<ItemGroup>
<ProjectReference Include="..\bunit.core\bunit.core.csproj" />
<ProjectReference Include="..\bunit.generators.internal\bunit.generators.internal.csproj" OutputItemType="Analyzer" ReferenceOutputAssembly="false" />
Expand Down
6 changes: 3 additions & 3 deletions src/bunit/bunit.csproj
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFrameworks>netstandard2.1;net5.0;net6.0;net7.0;net8.0</TargetFrameworks>
<TargetFrameworks>netstandard2.1;net5.0;net6.0;net7.0;net8.0;net9.0</TargetFrameworks>
<NoBuild>true</NoBuild>
<IncludeBuildOutput>false</IncludeBuildOutput>
<IncludeSymbols>false</IncludeSymbols>
<IncludeSymbols>false</IncludeSymbols>
</PropertyGroup>

<PropertyGroup>
Expand All @@ -25,4 +25,4 @@
<ProjectReference Include="..\bunit.web\bunit.web.csproj" />
</ItemGroup>

</Project>
</Project>
2 changes: 1 addition & 1 deletion tests/bunit.core.tests/bunit.core.tests.csproj
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk.Razor">

<PropertyGroup>
<TargetFrameworks>netcoreapp3.1;net5.0;net6.0;net7.0;net8.0</TargetFrameworks>
<TargetFrameworks>netcoreapp3.1;net5.0;net6.0;net7.0;net8.0;net9.0</TargetFrameworks>
<RootNamespace>Bunit</RootNamespace>
<AssemblyName>Bunit.Core.Tests</AssemblyName>
</PropertyGroup>
Expand Down
8 changes: 7 additions & 1 deletion tests/bunit.testassets/bunit.testassets.csproj
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk.Razor">

<PropertyGroup>
<TargetFrameworks>netstandard2.1;net5.0;net6.0;net7.0;net8.0</TargetFrameworks>
<TargetFrameworks>netstandard2.1;net5.0;net6.0;net7.0;net8.0;net9.0</TargetFrameworks>
<RootNamespace>Bunit.TestAssets</RootNamespace>
<AssemblyName>Bunit.TestAssets</AssemblyName>
<OutputType>Library</OutputType>
Expand Down Expand Up @@ -52,5 +52,11 @@
<PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly.Authentication" Version="$(DotNet8Version)" />
<PackageReference Include="Serilog.Extensions.Logging" Version="8.0.0" />
</ItemGroup>
<ItemGroup Condition="'$(TargetFramework)' == 'net9.0'">
<PackageReference Include="Microsoft.Extensions.Localization.Abstractions" Version="$(DotNet9Version)" />
<PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly" Version="$(DotNet9Version)" />
<PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly.Authentication" Version="$(DotNet9Version)" />
<PackageReference Include="Serilog.Extensions.Logging" Version="8.0.0" />
</ItemGroup>

</Project>
2 changes: 1 addition & 1 deletion tests/bunit.web.query.tests/bunit.web.query.tests.csproj
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk.Razor">

<PropertyGroup>
<TargetFrameworks>netcoreapp3.1;net5.0;net6.0;net7.0;net8.0</TargetFrameworks>
<TargetFrameworks>netcoreapp3.1;net5.0;net6.0;net7.0;net8.0;net9.0</TargetFrameworks>
<RootNamespace>Bunit</RootNamespace>
<AssemblyName>Bunit.Web.Query.Tests</AssemblyName>
</PropertyGroup>
Expand Down
2 changes: 1 addition & 1 deletion tests/bunit.web.tests/JSInterop/BunitJSInteropTest.net5.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#if !NETCOREAPP3_1
#if !NETCOREAPP3_1 && !NET9_0_OR_GREATER
#pragma warning disable CS0618 // This method is obsolete.
using System;
using System.Linq;
Expand Down
8 changes: 6 additions & 2 deletions tests/bunit.web.tests/JSInterop/BunitJSObjectReferenceTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -259,6 +259,7 @@ public void Test070()
jsRuntime.ShouldBeAssignableTo<IJSInProcessObjectReference>();
}

#if !NET9_0_OR_GREATER
[Fact(DisplayName = "IJSObjectReference can be cast to IJSUnmarshalledObjectReference")]
public void Test071()
{
Expand All @@ -268,7 +269,8 @@ public void Test071()

jsRuntime.ShouldBeAssignableTo<IJSUnmarshalledObjectReference>();
}

#endif

[Fact(DisplayName = "IJSInProcessObjectReference-invocations is handled by handlers from BunitJSInterop")]
public async Task Test080()
{
Expand All @@ -289,7 +291,8 @@ public async Task Test080()
JSInterop.VerifyInvoke("bar5");
JSInterop.VerifyInvoke("bar6").Arguments.ShouldBe(new[] { "baz" });
}


#if !NET9_0_OR_GREATER
[Fact(DisplayName = "IJSUnmarshalledObjectReference-invocations is handled by handlers from BunitJSInterop")]
public async Task Test081()
{
Expand Down Expand Up @@ -391,6 +394,7 @@ public void Test308(string identifier, string arg0, string arg1, string arg2)
resultType: typeof(string),
invocationMethodName: "InvokeUnmarshalled"));
}
#endif

[Theory(DisplayName = "When calling InvokeVoidAsync, then the invocation should be visible from the Invocations list"), AutoData]
public void Test302(string identifier, string[] args, CancellationToken cancellationToken)
Expand Down
2 changes: 1 addition & 1 deletion tests/bunit.web.tests/bunit.web.tests.csproj
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk.Razor">

<PropertyGroup>
<TargetFrameworks>netcoreapp3.1;net5.0;net6.0;net7.0;net8.0</TargetFrameworks>
<TargetFrameworks>netcoreapp3.1;net5.0;net6.0;net7.0;net8.0;net9.0</TargetFrameworks>
<RootNamespace>Bunit</RootNamespace>
<AssemblyName>Bunit.Web.Tests</AssemblyName>
</PropertyGroup>
Expand Down

0 comments on commit b859378

Please sign in to comment.