Files
Giants/Tests/Giants.Core.Tests/Entities/BoardLayoutTests.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

67 lines
1.8 KiB
C#

using Giants.Core.Enums;
using Giants.Core.Interfaces;
using Giants.Infrastructure;
namespace Giants.Core.Tests;
public class BoardLayoutTests
{
[Fact]
public void TestNeighbour()
{
IHexagonalGrid grid = new HexagonalGridImpl();
BoardLayout layout = new BoardLayout(grid);
var test = layout.GetNeighbours(new AxialCoords(2, 6)).ToList();
foreach (var voisin in new List<AxialCoords>() {
new AxialCoords(3,5),
new AxialCoords(1,6),
new AxialCoords(3,6),
new AxialCoords(2,5),
new AxialCoords(2,7),
})
{
Assert.Contains(voisin, test);
}
Assert.Equal(5, test.Count);
}
[Fact]
public void TestNeighbourWhenAhu()
{
IHexagonalGrid grid = new HexagonalGridImpl();
BoardLayout layout = new BoardLayout(grid);
var test = layout.GetNeighbours(new AxialCoords(14, -2)).ToList();
foreach (var voisin in new List<AxialCoords>() {
new AxialCoords(13,-2),
new AxialCoords(13,-1),
new AxialCoords(14,-1),
})
{
Assert.Contains(voisin, test);
}
Assert.Equal(3, test.Count);
}
[Fact]
public void CheckIndexToEnum()
{
IHexagonalGrid grid = new HexagonalGridImpl();
BoardLayout layout = new BoardLayout(grid);
Assert.Equal(PiecePosition.tile144, layout.FromTileIndex(144));
}
[Fact]
public void CheckForestQuantities()
{
IHexagonalGrid grid = new HexagonalGridImpl();
BoardLayout layout = new BoardLayout(grid);
int forest1Index = layout.ForestIndex(new AxialCoords(4, 2));
Assert.Equal(0, forest1Index);
int qteForest1 = layout.ForestQte(forest1Index);
Assert.Equal(5, qteForest1);
}
}