File tree Expand file tree Collapse file tree
Codebreaker.GameAPIs.Models.Tests
services/gameapi/Codebreaker.GameAPIs.Models Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1616 <IncludeAssets >runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets >
1717 <PrivateAssets >all</PrivateAssets >
1818 </PackageReference >
19- <PackageReference Include =" coverlet.collector" Version =" 6.0.1 " >
19+ <PackageReference Include =" coverlet.collector" Version =" 6.0.2 " >
2020 <IncludeAssets >runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets >
2121 <PrivateAssets >all</PrivateAssets >
2222 </PackageReference >
Original file line number Diff line number Diff line change 1- namespace Codebreaker . GameAPIs . Extensions ;
1+ using System . Runtime . CompilerServices ;
2+
3+ namespace Codebreaker . GameAPIs . Extensions ;
24
35public static class GameExtensions
46{
57 [ Obsolete ( "Use HasEnded instead" ) ]
68 public static bool Ended ( this Game game ) => HasEnded ( game ) ;
79 public static bool HasEnded ( this Game game ) => game . EndTime != null ;
10+
11+ public static GameSummary ToGameSummary ( this Game game ) =>
12+ new (
13+ game . Id ,
14+ game . GameType ,
15+ game . PlayerName ,
16+ game . HasEnded ( ) ,
17+ game . IsVictory ,
18+ game . LastMoveNumber ,
19+ game . StartTime ,
20+ game . Duration ?? TimeSpan . MaxValue ) ;
821}
Original file line number Diff line number Diff line change @@ -6,6 +6,7 @@ public record class GameSummary(
66 string PlayerName ,
77 bool IsCompleted ,
88 bool IsVictory ,
9+ int NumberMoves ,
910 DateTime StartTime ,
1011 TimeSpan Duration )
1112{
You can’t perform that action at this time.
0 commit comments