Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
<PrivateAssets>all</PrivateAssets>
</PackageReference>
<PackageReference Include="coverlet.collector" Version="6.0.1">
<PackageReference Include="coverlet.collector" Version="6.0.2">
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
<PrivateAssets>all</PrivateAssets>
</PackageReference>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,21 @@
namespace Codebreaker.GameAPIs.Extensions;
using System.Runtime.CompilerServices;

namespace Codebreaker.GameAPIs.Extensions;

public static class GameExtensions
{
[Obsolete("Use HasEnded instead")]
public static bool Ended(this Game game) => HasEnded(game);
public static bool HasEnded(this Game game) => game.EndTime != null;

public static GameSummary ToGameSummary(this Game game) =>
new(
game.Id,
game.GameType,
game.PlayerName,
game.HasEnded(),
game.IsVictory,
game.LastMoveNumber,
game.StartTime,
game.Duration ?? TimeSpan.MaxValue);
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ public record class GameSummary(
string PlayerName,
bool IsCompleted,
bool IsVictory,
int NumberMoves,
DateTime StartTime,
TimeSpan Duration)
{
Expand Down