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

import it.polimi.ingsw.gc14.Model.Cards.TribeCards.Characters.Builder;
import it.polimi.ingsw.gc14.Model.Player;
import org.junit.jupiter.api.Test;

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

class Building8Test {

    @Test
    void applyEffect() {
        Building8 b8 = new Building8(1, 1, 1);
        Player p = new Player("test");
        p.addFood(b8.getPrice());
        b8.buy(p);

        int Era = 1;
        int PrestigeMul = 1;
        Builder builder1 = new Builder(Era, 1, PrestigeMul);
        p.builders.add(builder1);

        b8.applyEffect(p);

        assertEquals(1, p.buildingCards.stream().filter(x -> x.getEffectId() == 8).count());
        assertEquals(PrestigeMul * 2 * p.buildingCards.stream().filter(x -> x.getEffectId() == 8).count(), p.getPrestigeValue());

        Builder b2 = new Builder(Era, 1, PrestigeMul);
        p.builders.add(b2);
        b8.applyEffect(p);

        assertEquals(2 + 4, p.getPrestigeValue());
    }
}