using CoreLibrary;
using CoreLibrary.Regles;
using CoreLibrary.Core;
using Xunit;

namespace UnitTesting
{
    public class ProgramUT
    {
        [Fact]
        public void TestPartieConfiguration()
        {
            
            IRegles regle = new ReglesClassiques();
            Partie maPartie = new Partie(new ReglesClassiques());

            
            bool demanderJoueurCalled = false;
            bool debutPartieCalled = false;
            bool nouveauTourCalled = false;
            bool demanderJetonCalled = false;
            bool ajouterJetonCalled = false;
            bool ajouterCodeCalled = false;
            bool partieTermineeCalled = false;

            maPartie.DemanderJoueur += (sender, e) =>
            {
                demanderJoueurCalled = true;
                return $"Joueur {e.Numero}";
            };
            maPartie.DebutPartie += (sender, e) => debutPartieCalled = true;
            maPartie.NouveauTour += (sender, e) => nouveauTourCalled = true;
            maPartie.DemanderJeton += (sender, e) =>
            {
                demanderJetonCalled = true;
                return new Jeton();
            };
            maPartie.AjouterJeton += (sender, e) => ajouterJetonCalled = true;
            maPartie.AjouterCode += (sender, e) => ajouterCodeCalled = true;
            maPartie.PartieTerminee += (sender, e) => partieTermineeCalled = true;

          
            maPartie.Jouer();

            
            Assert.True(demanderJoueurCalled);
            Assert.True(debutPartieCalled);
            Assert.True(nouveauTourCalled);
            Assert.True(demanderJetonCalled);
            Assert.True(ajouterJetonCalled);
            Assert.True(ajouterCodeCalled);
            Assert.True(partieTermineeCalled);
        }
    }
}
