All checks were successful
check main state / build (9.0.x) (push) Successful in 2m46s
51 lines
1.2 KiB
C#
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);
|
|
}
|
|
|
|
}
|