using LittleTown.Core.Actions;
using LittleTown.Core.Exceptions;
using LittleTown.StaticDataAcces;

namespace LittleTown.Core.Tests;

public class MatchWorkflowTesting
{


    [Fact]
    public void Simple2PlayerGame()
    {
        StaticDataGetter getter = new StaticDataGetter();

        Match match = new Match(getter);
        match.AddPlayer("Player1");
        match.AddPlayer("Player2");
        match.Init();

        int count = 0;
        while (!match.IsDone)
        {
            EmptyAction action = new EmptyAction();
            match.ExecuteAction(action);
            count++;
            if (count > 40)
            {
                Assert.Fail("Trop d'action pour une partie vide");
            }
        }
        Assert.Throws<MatchFinishedException>(() => match.ExecuteAction(new EmptyAction()));
    }
}