package it.polimi.ingsw.gc14.Model.Cards.Building.Effects;

import it.polimi.ingsw.gc14.Model.Cards.TribeCards.CharacterType;
import it.polimi.ingsw.gc14.Model.Player;
import it.polimi.ingsw.gc14.Model.Cards.BuildingCard;
import org.junit.jupiter.api.DisplayName;
import org.junit.jupiter.api.Test;

import static org.junit.jupiter.api.Assertions.*;

class Building1Test {

    @Test
    @DisplayName("Testing constructor and icon getter method")
    void testConstructorAndGetter() {
        CharacterType ct = CharacterType.INVENTOR;
        Building1 b0 = new Building1(1,2,3, ct);

        assertEquals(ct, b0.getIcon());
    }

    @Test
    @DisplayName("Apply Effect")
    void applyEffect(){
        String user = "test";
        Player p = new Player(user);
        assertTrue(p.buildingCards.isEmpty());
        assertTrue(p.inventors.isEmpty());
        assertTrue(p.builders.isEmpty());
        assertTrue(p.gatherers.isEmpty());
        assertTrue(p.shamans.isEmpty());
        assertTrue(p.hunters.isEmpty());
        assertTrue(p.artists.isEmpty());
        assertEquals(0, p.getFoodValue());
        assertEquals(0, p.getPrestigeValue());
        assertEquals(user, p.getUserName());

        Building1 b0 = new Building1(1,2,3, CharacterType.INVENTOR);
        b0.applyEffect(p);

        assertTrue(p.buildingCards.isEmpty());
        assertTrue(p.inventors.isEmpty());
        assertTrue(p.builders.isEmpty());
        assertTrue(p.gatherers.isEmpty());
        assertTrue(p.shamans.isEmpty());
        assertTrue(p.hunters.isEmpty());
        assertTrue(p.artists.isEmpty());
        assertEquals(0, p.getFoodValue());
        assertEquals(0, p.getPrestigeValue());
        assertEquals(user, p.getUserName());
    }

    @Test
    @DisplayName("Clone")
    void Clone(){
        int Era = 1;
        int Price = 2;
        int Prestige = 3;
        CharacterType ct = CharacterType.INVENTOR;
        Building1 b0 = new Building1(Era,Price,Prestige, ct);

        BuildingCard bClone = b0.clone();

        assertEquals(Era,b0.getEra());
        assertEquals(Price,b0.getPrice());
        assertEquals(Prestige, bClone.getPrestigeValue());
        assertEquals(ct, b0.getIcon());
    }
}