Ajout de la base de PrepareMatchCommand avec un test
All checks were successful
check main state / build (9.0.x) (push) Successful in 1m26s
All checks were successful
check main state / build (9.0.x) (push) Successful in 1m26s
This commit was merged in pull request #24.
This commit is contained in:
40
Tests/Giants.Core.Tests/Commands/PrepareMatchCommandTest.cs
Normal file
40
Tests/Giants.Core.Tests/Commands/PrepareMatchCommandTest.cs
Normal file
@@ -0,0 +1,40 @@
|
||||
using Giants.Application;
|
||||
using Giants.Core.Commands;
|
||||
using Giants.Core.Interfaces;
|
||||
using Giants.Infrastructure;
|
||||
|
||||
namespace Giants.Core.Tests;
|
||||
|
||||
public class PrepareMatchCommandTest
|
||||
{
|
||||
private readonly IMatchRepository _repo;
|
||||
|
||||
public PrepareMatchCommandTest()
|
||||
{
|
||||
IHexagonalGrid _grid = new HexagonalGridImpl();
|
||||
BoardLayout layout = new BoardLayout(_grid);
|
||||
_repo = new MatchRepositoryMock(layout);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
void SimpleInit()
|
||||
{
|
||||
NewMatchCommand command = new NewMatchCommand(_repo);
|
||||
NewMatchResult result = command.Execute();
|
||||
Match? m = result.Match;
|
||||
Assert.NotNull(m);
|
||||
|
||||
PrepareMatchCommand prepCommand = new PrepareMatchCommand() { InputMatch = m, PlayerIDs = new List<int>() { 12, 15, 5, 14, 9 } };
|
||||
var resultPrep = prepCommand.Execute();
|
||||
Assert.True(resultPrep.Success);
|
||||
Assert.NotNull(resultPrep?.Match);
|
||||
|
||||
Player? p1 = resultPrep.Match.GetPlayer(0);
|
||||
Assert.NotNull(p1);
|
||||
|
||||
Assert.Equal(5, p1.NbVisibleTribalTokenCount);
|
||||
Assert.Equal(0, p1.NbHiddenTribalTokenCount);
|
||||
Assert.Equal(1, p1.NbUrnTribalTokenCount);
|
||||
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user