ajout de la commande de creation de match

This commit was merged in pull request #7.
This commit is contained in:
2025-03-12 22:46:41 +01:00
parent f400674c1a
commit 7b00a91580
11 changed files with 199 additions and 14 deletions

View File

@@ -10,6 +10,9 @@ namespace Giants.Application;
public class MatchRepositoryMock : IMatchRepository
{
private readonly IHexagonalGrid _gridLayout;
private static int _lastId = 1;
private Dictionary<int, Match> _matchs = new Dictionary<int, Match>();
/// <summary>
/// constructeur
@@ -22,10 +25,31 @@ public class MatchRepositoryMock : IMatchRepository
/// <inheritdoc/>
public Match? GetMatch(int matchId)
{
Match result = new Match(_gridLayout);
if (_matchs.TryGetValue(matchId, out Match? found))
{
return found;
}
return null;
}
/// <inheritdoc/>
public Match CreateMatch()
{
Match result = new Match(_gridLayout)
{
Id = _lastId++
};
AddStaticData(result);
_matchs.Add(result.Id, result);
// Ajout des données statiques
return result;
}
private void AddStaticData(Match match)
{
}
}