Updated build target to dotnet 12. Fixed failed tests and runtime failures

This commit is contained in:
Martin Berg Alstad
2023-12-10 15:39:26 +01:00
parent 9991bac6fa
commit 3e424a127e
10 changed files with 22 additions and 33 deletions

View File

@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net7.0</TargetFramework>
<TargetFramework>net8.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
@ -13,7 +13,7 @@
<ItemGroup>
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.8.0"/>
<PackageReference Include="NSubstitute" Version="5.1.0"/>
<PackageReference Include="NUnit" Version="4.0.1" />
<PackageReference Include="NUnit" Version="4.0.1"/>
<PackageReference Include="NUnit3TestAdapter" Version="4.5.0"/>
<PackageReference Include="NUnit.Analyzers" Version="3.10.0">
<PrivateAssets>all</PrivateAssets>

View File

@ -10,8 +10,7 @@ using pacMan.Services;
namespace BackendTests.Services;
[TestFixture]
[TestOf(nameof(ActionService))]
[TestFixture, TestOf(nameof(ActionService))]
public class ActionServiceTests
{
[SetUp]
@ -157,7 +156,7 @@ public class ActionServiceTests
public void FindNextPlayer_NoPlayers()
{
_service.Game = new pacMan.Services.Game(new Queue<DirectionalPosition>());
Assert.Throws<InvalidOperationException>(() => _service.FindNextPlayer());
Assert.Throws<PlayerNotFoundException>(() => _service.FindNextPlayer());
}
[Test]

View File

@ -6,8 +6,7 @@ using pacMan.Utils;
namespace BackendTests.Services;
[TestFixture]
[TestOf(nameof(pacMan.Services.Game))]
[TestFixture, TestOf(nameof(pacMan.Services.Game))]
public class GameTests
{
[SetUp]
@ -56,7 +55,7 @@ public class GameTests
[Test]
public void NextPlayer_WhenEmpty()
{
Assert.Throws<InvalidOperationException>(() => _game.NextPlayer());
Assert.Throws<PlayerNotFoundException>(() => _game.NextPlayer());
}
[Test]