import at.reisinger.enums.CardType;
import at.reisinger.enums.ElementTyp;
import at.reisinger.obj.*;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;

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


public class TradingDealTest {

    private TradingDeal tradingDeal;
    private Card newCard, card;

    @BeforeEach
    void setUp() {
        card = new Card("Name", 10, ElementTyp.WATER, CardType.MONSTER);
        newCard = new Card("NameNew", 10, ElementTyp.WATER, CardType.SPELL);
        Card cardToTrade = card;
        ElementTyp requiredElementType = ElementTyp.FIRE;
        double requiredMinDamage = 100;
        CardType requiredCardType = CardType.MONSTER;
        tradingDeal = new TradingDeal("ID", cardToTrade, requiredElementType, requiredMinDamage, requiredCardType, "NAME");
    }

    @Test
    void test_getCardToTrade() {
        Card result = tradingDeal.getCardToTrade();
        assertTrue(result.equals(card));
    }
    @Test
    void test_getRequiredElementType() {
        ElementTyp result = tradingDeal.getRequiredElementType();
        assertSame(result, ElementTyp.FIRE);
    }
    @Test
    void test_getRequiredMinDamage() {
        double result = tradingDeal.getRequiredMinDamage();
        assertEquals(result, 100);
    }
    @Test
    void test_getRequiredCardType() {
        CardType result = tradingDeal.getRequiredCardType();
        assertSame(result, CardType.MONSTER);
    }

    @Test
    void test_setCardToTrade() {
        tradingDeal.setCardToTrade(newCard);
        Card result = tradingDeal.getCardToTrade();
        assertSame(result, newCard);
    }
    @Test
    void test_setRequiredElementType() {
        tradingDeal.setRequiredElementType(ElementTyp.WATER);
        ElementTyp result = tradingDeal.getRequiredElementType();
        assertSame(result, ElementTyp.WATER);
    }
    @Test
    void test_setRequiredMinDamage() {
        tradingDeal.setRequiredMinDamage(10);
        double result = tradingDeal.getRequiredMinDamage();
        assertEquals(result, 10);
    }
    @Test
    void test_setRequiredCardType() {
        tradingDeal.setRequiredCardType(CardType.SPELL);
        CardType result = tradingDeal.getRequiredCardType();
        assertSame(result, CardType.SPELL);
    }
}
