43 lines
1.1 KiB
C#
43 lines
1.1 KiB
C#
namespace Giants.Core.Tests;
|
|
|
|
using Giants.Application;
|
|
using Giants.Core.Commands;
|
|
using Giants.Core.Interfaces;
|
|
using Giants.Infrastructure;
|
|
|
|
public class NewMatchCommandTest
|
|
{
|
|
private readonly IMatchRepository _repo;
|
|
|
|
public NewMatchCommandTest()
|
|
{
|
|
IHexagonalGrid _grid = new HexagonalGridImpl();
|
|
BoardLayout layout = new BoardLayout(_grid);
|
|
_repo = new MatchRepositoryMock(layout);
|
|
}
|
|
|
|
[Fact]
|
|
public void CreateBasicMatch()
|
|
{
|
|
NewMatchCommand command = new NewMatchCommand(_repo);
|
|
NewMatchResult result = command.Execute();
|
|
Assert.True(result.Success);
|
|
}
|
|
|
|
[Fact]
|
|
public void TwoNewMatchShouldHaveDifferentID()
|
|
{
|
|
NewMatchCommand command = new NewMatchCommand(_repo);
|
|
NewMatchResult result = command.Execute();
|
|
Assert.True(result.Success);
|
|
Assert.NotNull(result.Match);
|
|
|
|
NewMatchCommand command2 = new NewMatchCommand(_repo);
|
|
NewMatchResult result2 = command2.Execute();
|
|
Assert.True(result2.Success);
|
|
Assert.NotNull(result2.Match);
|
|
|
|
Assert.NotEqual(result.Match.Id, result2.Match.Id);
|
|
}
|
|
}
|