diff --git a/src/Codebreaker.Backend.Models.sln b/src/Codebreaker.Backend.Models.sln index f7a4b501..7d9c1d09 100644 --- a/src/Codebreaker.Backend.Models.sln +++ b/src/Codebreaker.Backend.Models.sln @@ -5,6 +5,8 @@ VisualStudioVersion = 17.0.31903.59 MinimumVisualStudioVersion = 10.0.40219.1 Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Codebreaker.GameAPIs.Models", "services\gameapi\Codebreaker.GameAPIs.Models\Codebreaker.GameAPIs.Models.csproj", "{CFC6E983-72EF-49AB-A0B1-9BFD7620517D}" EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Codebreaker.GameAPIs.Models.Tests", "Codebreaker.GameAPIs.Models.Tests\Codebreaker.GameAPIs.Models.Tests.csproj", "{7CE99649-7DE1-4DA2-8E74-500595387669}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -15,8 +17,15 @@ Global {CFC6E983-72EF-49AB-A0B1-9BFD7620517D}.Debug|Any CPU.Build.0 = Debug|Any CPU {CFC6E983-72EF-49AB-A0B1-9BFD7620517D}.Release|Any CPU.ActiveCfg = Release|Any CPU {CFC6E983-72EF-49AB-A0B1-9BFD7620517D}.Release|Any CPU.Build.0 = Release|Any CPU + {7CE99649-7DE1-4DA2-8E74-500595387669}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {7CE99649-7DE1-4DA2-8E74-500595387669}.Debug|Any CPU.Build.0 = Debug|Any CPU + {7CE99649-7DE1-4DA2-8E74-500595387669}.Release|Any CPU.ActiveCfg = Release|Any CPU + {7CE99649-7DE1-4DA2-8E74-500595387669}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {F57641F5-33AD-474C-9AEF-FD6992AC8EB9} + EndGlobalSection EndGlobal diff --git a/src/Codebreaker.GameAPIs.Models.Tests/Codebreaker.GameAPIs.Models.Tests.csproj b/src/Codebreaker.GameAPIs.Models.Tests/Codebreaker.GameAPIs.Models.Tests.csproj new file mode 100644 index 00000000..959b6096 --- /dev/null +++ b/src/Codebreaker.GameAPIs.Models.Tests/Codebreaker.GameAPIs.Models.Tests.csproj @@ -0,0 +1,29 @@ + + + + net8.0 + enable + enable + + false + true + + + + + + + runtime; build; native; contentfiles; analyzers; buildtransitive + all + + + runtime; build; native; contentfiles; analyzers; buildtransitive + all + + + + + + + + diff --git a/src/services/gameapi/Codebreaker.GameAPIs.Models/Game.cs b/src/services/gameapi/Codebreaker.GameAPIs.Models/Game.cs index 9b85120a..cae34880 100644 --- a/src/services/gameapi/Codebreaker.GameAPIs.Models/Game.cs +++ b/src/services/gameapi/Codebreaker.GameAPIs.Models/Game.cs @@ -1,4 +1,5 @@ using Codebreaker.GameAPIs.Contracts; +using System.Text.Json.Serialization; namespace Codebreaker.GameAPIs.Models; @@ -25,7 +26,10 @@ public class Game( public required IDictionary> FieldValues { get; init; } public required string[] Codes { get; init; } - public ICollection Moves { get; } = new List(); + + [JsonInclude] + private List _moves = []; + public ICollection Moves => _moves; public override string ToString() => $"{Id}:{GameType} - {StartTime}"; } diff --git a/src/services/gameapi/Codebreaker.GameAPIs.Models/Move.cs b/src/services/gameapi/Codebreaker.GameAPIs.Models/Move.cs index 3b47341f..f5e8b71c 100644 --- a/src/services/gameapi/Codebreaker.GameAPIs.Models/Move.cs +++ b/src/services/gameapi/Codebreaker.GameAPIs.Models/Move.cs @@ -14,7 +14,7 @@ public class Move(Guid id, int moveNumber) /// public required string[] GuessPegs { get; init; } /// - /// The result from the analyer for this move based on the associated game that contains the move. + /// The result from the analyzer for this move based on the associated game that contains the move. /// public required string[] KeyPegs { get; init; } diff --git a/src/services/gameapi/Codebreaker.GameAPIs.Models/docs/readme.md b/src/services/gameapi/Codebreaker.GameAPIs.Models/docs/readme.md index 94c94599..d5bb33c8 100644 --- a/src/services/gameapi/Codebreaker.GameAPIs.Models/docs/readme.md +++ b/src/services/gameapi/Codebreaker.GameAPIs.Models/docs/readme.md @@ -19,5 +19,5 @@ See [Codebreakerlight](https://github.com/codebreakerapp/codebreakerlight) for a | Type | Description | | --- | --- | | CodebreakerException | Exceptions thrown within the backend. | -| CodebreakerExceptionCodes | Contants of exception codes. | +| CodebreakerExceptionCodes | Constants of exception codes. | | GameExtensions | Extension methods for the Game type. |