Updated build target to dotnet 12. Fixed failed tests and runtime failures
This commit is contained in:
parent
9991bac6fa
commit
3e424a127e
@ -1,5 +1,6 @@
|
|||||||
<component name="ProjectCodeStyleConfiguration">
|
<component name="ProjectCodeStyleConfiguration">
|
||||||
<state>
|
<state>
|
||||||
<option name="USE_PER_PROJECT_SETTINGS" value="true" />
|
<option name="USE_PER_PROJECT_SETTINGS" value="true" />
|
||||||
|
<option name="PREFERRED_PROJECT_CODE_STYLE" value="Default" />
|
||||||
</state>
|
</state>
|
||||||
</component>
|
</component>
|
@ -1,7 +1,7 @@
|
|||||||
<Project Sdk="Microsoft.NET.Sdk">
|
<Project Sdk="Microsoft.NET.Sdk">
|
||||||
|
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<TargetFramework>net7.0</TargetFramework>
|
<TargetFramework>net8.0</TargetFramework>
|
||||||
<ImplicitUsings>enable</ImplicitUsings>
|
<ImplicitUsings>enable</ImplicitUsings>
|
||||||
<Nullable>enable</Nullable>
|
<Nullable>enable</Nullable>
|
||||||
|
|
||||||
|
@ -10,8 +10,7 @@ using pacMan.Services;
|
|||||||
|
|
||||||
namespace BackendTests.Services;
|
namespace BackendTests.Services;
|
||||||
|
|
||||||
[TestFixture]
|
[TestFixture, TestOf(nameof(ActionService))]
|
||||||
[TestOf(nameof(ActionService))]
|
|
||||||
public class ActionServiceTests
|
public class ActionServiceTests
|
||||||
{
|
{
|
||||||
[SetUp]
|
[SetUp]
|
||||||
@ -157,7 +156,7 @@ public class ActionServiceTests
|
|||||||
public void FindNextPlayer_NoPlayers()
|
public void FindNextPlayer_NoPlayers()
|
||||||
{
|
{
|
||||||
_service.Game = new pacMan.Services.Game(new Queue<DirectionalPosition>());
|
_service.Game = new pacMan.Services.Game(new Queue<DirectionalPosition>());
|
||||||
Assert.Throws<InvalidOperationException>(() => _service.FindNextPlayer());
|
Assert.Throws<PlayerNotFoundException>(() => _service.FindNextPlayer());
|
||||||
}
|
}
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
|
@ -6,8 +6,7 @@ using pacMan.Utils;
|
|||||||
|
|
||||||
namespace BackendTests.Services;
|
namespace BackendTests.Services;
|
||||||
|
|
||||||
[TestFixture]
|
[TestFixture, TestOf(nameof(pacMan.Services.Game))]
|
||||||
[TestOf(nameof(pacMan.Services.Game))]
|
|
||||||
public class GameTests
|
public class GameTests
|
||||||
{
|
{
|
||||||
[SetUp]
|
[SetUp]
|
||||||
@ -56,7 +55,7 @@ public class GameTests
|
|||||||
[Test]
|
[Test]
|
||||||
public void NextPlayer_WhenEmpty()
|
public void NextPlayer_WhenEmpty()
|
||||||
{
|
{
|
||||||
Assert.Throws<InvalidOperationException>(() => _game.NextPlayer());
|
Assert.Throws<PlayerNotFoundException>(() => _game.NextPlayer());
|
||||||
}
|
}
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
<Project Sdk="Microsoft.NET.Sdk">
|
<Project Sdk="Microsoft.NET.Sdk">
|
||||||
|
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<TargetFramework>net7.0</TargetFramework>
|
<TargetFramework>net8.0</TargetFramework>
|
||||||
<ImplicitUsings>enable</ImplicitUsings>
|
<ImplicitUsings>enable</ImplicitUsings>
|
||||||
<Nullable>enable</Nullable>
|
<Nullable>enable</Nullable>
|
||||||
<RootNamespace>DAL</RootNamespace>
|
<RootNamespace>DAL</RootNamespace>
|
||||||
|
@ -5,11 +5,9 @@ using pacMan.GameStuff.Items;
|
|||||||
namespace pacMan.DTOs;
|
namespace pacMan.DTOs;
|
||||||
|
|
||||||
public readonly record struct JoinGameData(
|
public readonly record struct JoinGameData(
|
||||||
[property: JsonInclude]
|
[property: JsonInclude, JsonPropertyName("username"), JsonRequired]
|
||||||
[property: JsonPropertyName("username")]
|
|
||||||
string Username,
|
string Username,
|
||||||
[property: JsonInclude]
|
[property: JsonInclude, JsonPropertyName("gameId"), JsonRequired]
|
||||||
[property: JsonPropertyName("gameId")]
|
|
||||||
Guid GameId
|
Guid GameId
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
@ -17,34 +15,26 @@ public readonly record struct JoinGameData(
|
|||||||
}
|
}
|
||||||
|
|
||||||
public readonly record struct CreateGameData(
|
public readonly record struct CreateGameData(
|
||||||
[property: JsonInclude]
|
[property: JsonInclude, JsonPropertyName("player"), JsonRequired]
|
||||||
[property: JsonPropertyName("player")]
|
|
||||||
Player Player,
|
Player Player,
|
||||||
[property: JsonInclude]
|
[property: JsonInclude, JsonPropertyName("spawns"), JsonRequired]
|
||||||
[property: JsonPropertyName("spawns")]
|
|
||||||
Queue<DirectionalPosition> Spawns
|
Queue<DirectionalPosition> Spawns
|
||||||
);
|
);
|
||||||
|
|
||||||
public readonly record struct ReadyData(
|
public readonly record struct ReadyData(
|
||||||
[property: JsonInclude]
|
[property: JsonInclude, JsonPropertyName("allReady"), JsonRequired]
|
||||||
[property: JsonPropertyName("allReady")]
|
|
||||||
bool AllReady,
|
bool AllReady,
|
||||||
[property: JsonInclude]
|
[property: JsonInclude, JsonPropertyName("players"), JsonRequired]
|
||||||
[property: JsonPropertyName("players")]
|
|
||||||
IEnumerable<Player> Players
|
IEnumerable<Player> Players
|
||||||
);
|
);
|
||||||
|
|
||||||
public readonly record struct MovePlayerData(
|
public readonly record struct MovePlayerData(
|
||||||
[property: JsonInclude]
|
[property: JsonInclude, JsonPropertyName("players"), JsonRequired]
|
||||||
[property: JsonPropertyName("players")]
|
|
||||||
List<Player> Players,
|
List<Player> Players,
|
||||||
[property: JsonInclude]
|
[property: JsonInclude, JsonPropertyName("ghosts"), JsonRequired]
|
||||||
[property: JsonPropertyName("ghosts")]
|
|
||||||
List<Character> Ghosts,
|
List<Character> Ghosts,
|
||||||
[property: JsonInclude]
|
[property: JsonInclude, JsonPropertyName("dice"), JsonRequired]
|
||||||
[property: JsonPropertyName("dice")]
|
|
||||||
List<int> Dice,
|
List<int> Dice,
|
||||||
[property: JsonInclude]
|
[property: JsonInclude, JsonPropertyName("eatenPellets"), JsonRequired]
|
||||||
[property: JsonPropertyName("eatenPellets")]
|
|
||||||
List<Position> EatenPellets
|
List<Position> EatenPellets
|
||||||
);
|
);
|
||||||
|
@ -24,7 +24,7 @@ public interface IActionService
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// Provides various actions that can be performed in a game
|
/// Provides various actions that can be performed in a game
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public class ActionService(ILogger logger, IGameService gameService) : IActionService
|
public class ActionService(ILogger<ActionService> logger, IGameService gameService) : IActionService
|
||||||
{
|
{
|
||||||
public WebSocket WebSocket { private get; set; } = null!;
|
public WebSocket WebSocket { private get; set; } = null!;
|
||||||
|
|
||||||
|
@ -17,7 +17,7 @@ public interface IGameService : IWebSocketService
|
|||||||
/// The GameService class provides functionality for managing games in a WebSocket environment. It inherits from the
|
/// The GameService class provides functionality for managing games in a WebSocket environment. It inherits from the
|
||||||
/// WebSocketService class.
|
/// WebSocketService class.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public class GameService(ILogger logger) : WebSocketService(logger), IGameService
|
public class GameService(ILogger<WebSocketService> logger) : WebSocketService(logger), IGameService
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// A thread-safe collection (SynchronizedCollection) of "Game" objects. Utilized for managing multiple game instances
|
/// A thread-safe collection (SynchronizedCollection) of "Game" objects. Utilized for managing multiple game instances
|
||||||
|
@ -13,7 +13,7 @@ public interface IWebSocketService
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// WebSocketService class provides methods to send, receive and close a WebSocket connection.
|
/// WebSocketService class provides methods to send, receive and close a WebSocket connection.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public class WebSocketService(ILogger logger) : IWebSocketService
|
public class WebSocketService(ILogger<WebSocketService> logger) : IWebSocketService
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Sends the specified byte array as a text message through the WebSocket connection.
|
/// Sends the specified byte array as a text message through the WebSocket connection.
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
<Project Sdk="Microsoft.NET.Sdk.Web">
|
<Project Sdk="Microsoft.NET.Sdk.Web">
|
||||||
|
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<TargetFramework>net7.0</TargetFramework>
|
<TargetFramework>net8.0</TargetFramework>
|
||||||
<Nullable>enable</Nullable>
|
<Nullable>enable</Nullable>
|
||||||
<TypeScriptCompileBlocked>true</TypeScriptCompileBlocked>
|
<TypeScriptCompileBlocked>true</TypeScriptCompileBlocked>
|
||||||
<TypeScriptToolsVersion>Latest</TypeScriptToolsVersion>
|
<TypeScriptToolsVersion>Latest</TypeScriptToolsVersion>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user