Files
Giants/Tests/Giants.Core.Tests/Commands/GetMatchCommandTest.cs
mcmuzzle 3dba66344d
All checks were successful
check main state / build (9.0.x) (push) Successful in 2m46s
fin de l'initialisation d'un match et ajout du random aux commandes
2025-04-24 22:31:19 +02:00

51 lines
1.2 KiB
C#

namespace Giants.Core.Tests;
using Giants.Application;
using Giants.Core.Commands;
using Giants.Core.Interfaces;
using Giants.Infrastructure;
public class GetMatchCommandTest
{
private readonly IMatchRepository _repo;
public GetMatchCommandTest()
{
IHexagonalGrid _grid = new HexagonalGridImpl();
BoardLayout layout = new BoardLayout(_grid);
_repo = new MatchRepositoryMock(layout);
var match1 = _repo.CreateMatch();
}
[Fact]
public void GetMatchNotExisting()
{
Random random = new Random(1);
GetMatchCommand command = new GetMatchCommand(_repo)
{
MatchId = 2,
Random = random
};
GetMatchResult result = command.Execute();
Assert.False(result.Success);
Assert.Null(result.Match);
}
[Fact]
public void GetMatchSimple()
{
Random random = new Random(1);
GetMatchCommand command = new GetMatchCommand(_repo)
{
MatchId = 1,
Random = random
};
GetMatchResult result = command.Execute();
Assert.True(result.Success);
Assert.NotNull(result.Match);
}
}