Skip to content

Commit

Permalink
Add support for .NET 8, NUnit 4.0 (#188)
Browse files Browse the repository at this point in the history
* Added support for .NET 8, Nuget 4.0

* Fixes after peer review

* Fix netandard2.0 using earlier versions of NUnit

* add dotnet 8 to pipelines

* remove unnecessary changes

---------

Co-authored-by: Florian Rohrer <[email protected]>
  • Loading branch information
daghsentinel and RohrerF committed Jan 5, 2024
1 parent 4d6e71f commit 4fce39a
Show file tree
Hide file tree
Showing 13 changed files with 32 additions and 16 deletions.
1 change: 1 addition & 0 deletions .github/workflows/pull-request.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ jobs:
dotnet-version: |
6
7
8
- name: Build, Test and Sonar
uses: swisslife-oss/actions/pull-request@main
with:
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ jobs:
dotnet-version: |
6
7
8
- name: Restore tools
run: dotnet tool restore
- name: Build, Test and Sonar
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,15 @@

<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net6.0</TargetFramework>
<TargetFramework>net8.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<IsPackable>false</IsPackable>
<Optimize>true</Optimize>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="BenchmarkDotNet" Version="0.13.2" />
<PackageReference Include="BenchmarkDotNet" Version="0.13.10" />
</ItemGroup>

</Project>
2 changes: 1 addition & 1 deletion global.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"sdk": {
"version": "7.0.100",
"version": "8.0.100",
"rollForward": "latestMinor"
}
}
2 changes: 1 addition & 1 deletion src/Dependencies.props
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<Project>
<PropertyGroup Label="Framework Versions">
<ResourceProjectTargetFrameworks>netstandard2.0;netcoreapp3.1;net6.0;net7.0</ResourceProjectTargetFrameworks>
<ResourceProjectTargetFrameworks>netstandard2.0;net6.0;net7.0;net8.0</ResourceProjectTargetFrameworks>
</PropertyGroup>
</Project>
2 changes: 1 addition & 1 deletion src/Package.props
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.SourceLink.GitHub" Version="1.1.1" PrivateAssets="All"/>
<PackageReference Include="Microsoft.SourceLink.GitHub" Version="8.0.0" PrivateAssets="All"/>
</ItemGroup>

</Project>
9 changes: 8 additions & 1 deletion src/Snapshooter.NUnit/Snapshooter.NUnit.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,16 @@
<IsTestProject>false</IsTestProject>
</PropertyGroup>

<ItemGroup Condition=" '$(TargetFramework)' == 'netstandard2.0' ">
<PackageReference Include="NUnit" Version="3.14.0" />
</ItemGroup>

<ItemGroup Condition=" '$(TargetFramework)' != 'netstandard2.0' ">
<PackageReference Include="NUnit" Version="4.0.1" />
</ItemGroup>

<ItemGroup>
<PackageReference Include="Microsoft.CSharp" Version="4.7.0" />
<PackageReference Include="NUnit" Version="3.13.3" />
</ItemGroup>

<ItemGroup>
Expand Down
2 changes: 1 addition & 1 deletion src/Snapshooter/Snapshooter.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Newtonsoft.Json" Version="13.0.1" />
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
</ItemGroup>

</Project>
2 changes: 1 addition & 1 deletion test/Dependencies.props
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<Project>
<PropertyGroup Label="Framework Versions">
<TestProjectTargetFrameworks>netcoreapp3.1;net6.0;net7.0</TestProjectTargetFrameworks>
<TestProjectTargetFrameworks>net6.0;net7.0;net8.0</TestProjectTargetFrameworks>
</PropertyGroup>
</Project>
4 changes: 2 additions & 2 deletions test/Snapshooter.MSTest.Tests/Snapshooter.MSTest.Tests.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="MSTest.TestAdapter" Version="2.2.10" />
<PackageReference Include="MSTest.TestFramework" Version="2.2.10" />
<PackageReference Include="MSTest.TestAdapter" Version="3.1.1" />
<PackageReference Include="MSTest.TestFramework" Version="3.1.1" />
</ItemGroup>

<ItemGroup>
Expand Down
2 changes: 1 addition & 1 deletion test/Snapshooter.NUnit.Tests/NUnitAssertTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -28,4 +28,4 @@ public void Assert_AssertUnequalText_ThrowsEqualException()
Assert.That(action, Throws.TypeOf<AssertionException>());
}
}
}
}
11 changes: 9 additions & 2 deletions test/Snapshooter.NUnit.Tests/Snapshooter.NUnit.Tests.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,16 @@
<IsTestProject>true</IsTestProject>
</PropertyGroup>

<ItemGroup Condition=" '$(TargetFramework)' == 'netstandard2.0' ">
<PackageReference Include="NUnit" Version="3.14.0" />
</ItemGroup>

<ItemGroup Condition=" '$(TargetFramework)' != 'netstandard2.0' ">
<PackageReference Include="NUnit" Version="4.0.1" />
</ItemGroup>

<ItemGroup>
<PackageReference Include="nunit" Version="3.13.3" />
<PackageReference Include="NUnit3TestAdapter" Version="4.2.1" />
<PackageReference Include="NUnit3TestAdapter" Version="4.5.0" />
</ItemGroup>

<ItemGroup>
Expand Down
6 changes: 3 additions & 3 deletions test/Snapshooter.NUnit.Tests/SnapshotTests.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using System.IO;
using System.IO;
using NUnit.Framework;
using Snapshooter.Tests.Data;

Expand Down Expand Up @@ -61,7 +61,7 @@ public void Match_TestMatchNewSingleSnapshot_ExpectedSnapshotHasBeenCreated()
Snapshot.Match(testPerson);

// assert
Assert.True(File.Exists(snapshotFileName));
Assert.That(File.Exists(snapshotFileName));
}

[TestCase(36, 189.45)]
Expand Down Expand Up @@ -129,7 +129,7 @@ public void Match_TestCaseMatchNewSingleSnapshot_ExpectedSnapshotHasBeenCreated(
Snapshot.Match(testPerson);

// assert
Assert.True(File.Exists(snapshotFileName));
Assert.That(File.Exists(snapshotFileName));
}

#endregion
Expand Down

0 comments on commit 4fce39a

Please sign in to comment.