namespace Tests;
using Models.Game;

public class PlayerTests
{
    [Theory]
    [InlineData("Player", "DefaultProfilePicture")]
    [InlineData("John Doe", "N/A.png")]
    public void Constructor_WithPseudoAndProfilePicture_SetsPseudoAndProfilePictureCorrectly(string pseudo, string profilePicture)
    {
        var player = new Player(pseudo, profilePicture);
        Assert.Equal(pseudo, player.Pseudo);
        Assert.Equal(profilePicture, player.ProfilePicture);
    }

    [Fact]
    public void Constructor_WithPseudoAndWithoutProfilePicture_SetsPseudoAndDefaultProfilePicture()
    {
        var player = new Player("MyPlayer");
        Assert.Equal("MyPlayer", player.Pseudo);
        Assert.Equal("DefaultProfilePicture", player.ProfilePicture);
    }

    [Theory]
    [InlineData("John Doe", "John Doe", true)]
    [InlineData("John Doe", "Jane Doe", false)]
    public void Equals_WithSameOrDifferentPseudo_ReturnsExpectedResult(string pseudo1, string pseudo2, bool expectedResult)
    {
        var player1 = new Player(pseudo1);
        var player2 = new Player(pseudo2);
        Assert.Equal(expectedResult, player1.Equals(player2));
    }

    [Theory]
    [InlineData("John Doe", "John Doe", true)]
    [InlineData("John Doe", "Jane Doe", false)]
    public void GetHashCode_ReturnsSameOrDifferentHashCodeForPseudo(string pseudo1, string pseudo2, bool expectedResult)
    {
        var player1 = new Player(pseudo1);
        var player2 = new Player(pseudo2);
        Assert.Equal(expectedResult, player1.GetHashCode() == player2.GetHashCode());
    }

    [Fact]
    public void BaseConstructor_WithNoParameterssets_Default()
    {
        Player player = new Player();
        Assert.Equal("Player", player.Pseudo);
        Assert.Equal("DefaultProfilePicture", player.ProfilePicture);
    }

    [Fact]
    public void ChooseOperation_ReturnsLower()
    {
        Player player = new Player();
        Assert.Equal(Operation.LOWER, player.ChooseOperation());
    }

    [Fact]
    public void Equals_WithNull_ReturnsFalse()
    {
        Player player = new Player();
        Assert.False(player.Equals(null));
    }

    [Fact]
    public void Equals_WithDifferentType_ReturnsFalse()
    {
        Player player = new Player();
        Assert.False(player.Equals(new Cell(0, 0)));
    }


}