Files
Giants/Src/Giants.Application/Src/MatchRepositoryMock.cs
mcmuzzle af5337b2f2
All checks were successful
check main state / build (9.0.x) (push) Successful in 1m22s
ajout d'un debut de CI
2025-03-26 22:56:43 +01:00

60 lines
1.2 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 BoardLayout _boardLayout;
private int _lastId = 1;
private Dictionary<int, Match> _matchs = new Dictionary<int, Match>();
/// <summary>
/// constructeur
/// </summary>
public MatchRepositoryMock(BoardLayout boardLayout)
{
_boardLayout = boardLayout;
}
/// <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()
{
Id = _lastId++,
Board = _boardLayout,
};
AddStaticData(result);
_matchs.Add(result.Id, result);
return result;
}
private void AddStaticData(Match match)
{
}
public void SetMapData(IHexagonalGrid grid)
{
throw new NotImplementedException();
}
}