Files
Giants/Tests/Giants.Core.Tests/Commands/GetMatchCommandTest.cs

46 lines
1.0 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()
{
GetMatchCommand command = new GetMatchCommand(_repo)
{
MatchId = 2
};
GetMatchResult result = command.Execute();
Assert.False(result.Success);
Assert.Null(result.Match);
}
[Fact]
public void GetMatchSimple()
{
GetMatchCommand command = new GetMatchCommand(_repo)
{
MatchId = 1
};
GetMatchResult result = command.Execute();
Assert.True(result.Success);
Assert.NotNull(result.Match);
}
}