using LittleTown.Core.Enums;
using LittleTown.StaticDataAcces;

namespace LittleTown.Core.Tests;

public class BoardTesting
{

    private readonly Board _board;

    public BoardTesting()
    {
        StaticDataGetter getter = new StaticDataGetter();
        _board = getter.GetBoard(1);
    }

    [Fact]
    public void BoardGetTile()
    {
        Assert.Equal(ResourceType.Fish, _board.GetTile(0, 3)?.ResourceType);
    }

    [Fact]
    public void BoardGetArea()
    {
        ICollection<Tile> tilesCoin = _board.GetArea(0, 0);
        Assert.Equal(3, tilesCoin.Count);
        Assert.Equal(1, tilesCoin.Count(t => t.ResourceType == ResourceType.Wood));

        ICollection<Tile> tilesCentre = _board.GetArea(7, 1);
        Assert.Equal(8, tilesCentre.Count);
        Assert.Equal(2, tilesCentre.Count(t => t.ResourceType == ResourceType.Wood));
        Assert.Equal(1, tilesCentre.Count(t => t.ResourceType == ResourceType.Fish));

        ICollection<Tile> tilesBord = _board.GetArea(4, 5);
        Assert.Equal(5, tilesBord.Count);
        Assert.Equal(1, tilesBord.Count(t => t.ResourceType == ResourceType.Rock));
        Assert.Equal(1, tilesBord.Count(t => t.ResourceType == ResourceType.Fish));
    }
}