Files
Giants/Src/Giants.Application/Src/MatchRepositoryMock.cs

55 lines
1.1 KiB
C#

using Giants.Core.Interfaces;
using Giants.Core;
using Giants.Infrastructure;
namespace Giants.Application;
/// <summary>
/// Implementation temporaire du repository de match
/// </summary>
public class MatchRepositoryMock : IMatchRepository
{
private readonly IHexagonalGrid _gridLayout;
private static int _lastId = 1;
private Dictionary<int, Match> _matchs = new Dictionary<int, Match>();
/// <summary>
/// constructeur
/// </summary>
public MatchRepositoryMock()
{
_gridLayout = new HexagonalGridImpl();
}
/// <inheritdoc/>
public Match? GetMatch(int matchId)
{
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);
return result;
}
private void AddStaticData(Match match)
{
}
}