package it.polimi.ingsw.gc14.Model;

import org.junit.jupiter.api.Test;

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

class SlotTest {

    @Test
    void SlotWrongArgument() {
        assertDoesNotThrow(() -> {
            Slot sl1 = new Slot('A');
        });
        assertDoesNotThrow(() -> {
            Slot sl1 = new Slot('B');
        });
        assertDoesNotThrow(() -> {
            Slot sl1 = new Slot('C');
        });
        assertDoesNotThrow(() -> {
            Slot sl1 = new Slot('D');
        });
        assertDoesNotThrow(() -> {
            Slot sl1 = new Slot('E');
        });
        assertDoesNotThrow(() -> {
            Slot sl1 = new Slot('F');
        });
        assertDoesNotThrow(() -> {
            Slot sl1 = new Slot('G');
        });

        assertThrows(IllegalArgumentException.class, () -> {
            Slot sl1 = new Slot('H');
        });

    }

    @Test
    void SlotIdA() {
        char slotID = 'A';
        Slot s = new Slot(slotID);
        assertEquals(slotID, s.getSlotId());
        assertEquals('A', s.getSlotId());
        assertEquals(3, s.getFood());
        assertEquals(0, s.getNLower());
        assertEquals(0, s.getNUpper());
        assertEquals(5, s.getNMinPlayer());
        assertEquals("SlotID: "+slotID+"\nNUpper: "+s.getNUpper()+"\nNLower: "+s.getNLower()+"\nFood: "+s.getFood()+"\nNMinPlayer: "+s.getNMinPlayer()+"\n", s.toString());
    }

    @Test
    void SlotIdB() {
        char slotID = 'B';
        Slot s = new Slot(slotID);
        assertEquals(slotID, s.getSlotId());
        assertEquals('B', s.getSlotId());
        assertEquals(0, s.getFood());
        assertEquals(1, s.getNLower());
        assertEquals(0, s.getNUpper());
        assertEquals(0, s.getNMinPlayer());
        assertEquals("SlotID: "+slotID+"\nNUpper: "+s.getNUpper()+"\nNLower: "+s.getNLower()+"\nFood: "+s.getFood()+"\nNMinPlayer: "+s.getNMinPlayer()+"\n", s.toString());
    }

    @Test
    void SlotIdC() {
        char slotID = 'C';
        Slot s = new Slot(slotID);
        assertEquals(slotID, s.getSlotId());
        assertEquals('C', s.getSlotId());
        assertEquals(0, s.getFood());
        assertEquals(0, s.getNLower());
        assertEquals(1, s.getNUpper());
        assertEquals(0, s.getNMinPlayer());
        assertEquals("SlotID: "+slotID+"\nNUpper: "+s.getNUpper()+"\nNLower: "+s.getNLower()+"\nFood: "+s.getFood()+"\nNMinPlayer: "+s.getNMinPlayer()+"\n", s.toString());
    }

    @Test
    void SlotIdD() {
        char slotID = 'D';
        Slot s = new Slot(slotID);
        assertEquals(slotID, s.getSlotId());
        assertEquals('D', s.getSlotId());
        assertEquals(0, s.getFood());
        assertEquals(2, s.getNLower());
        assertEquals(0, s.getNUpper());
        assertEquals(3, s.getNMinPlayer());
        assertEquals("SlotID: "+slotID+"\nNUpper: "+s.getNUpper()+"\nNLower: "+s.getNLower()+"\nFood: "+s.getFood()+"\nNMinPlayer: "+s.getNMinPlayer()+"\n", s.toString());
    }

    @Test
    void SlotIdE() {
        char slotID = 'E';
        Slot s = new Slot(slotID);
        assertEquals(slotID, s.getSlotId());
        assertEquals('E', s.getSlotId());
        assertEquals(0, s.getFood());
        assertEquals(1, s.getNLower());
        assertEquals(1, s.getNUpper());
        assertEquals(0, s.getNMinPlayer());
        assertEquals("SlotID: "+slotID+"\nNUpper: "+s.getNUpper()+"\nNLower: "+s.getNLower()+"\nFood: "+s.getFood()+"\nNMinPlayer: "+s.getNMinPlayer()+"\n", s.toString());
    }

    @Test
    void SlotIdF() {
        char slotID = 'F';
        Slot s = new Slot(slotID);
        assertEquals(slotID, s.getSlotId());
        assertEquals('F', s.getSlotId());
        assertEquals(0, s.getFood());
        assertEquals(0, s.getNLower());
        assertEquals(2, s.getNUpper());
        assertEquals(0, s.getNMinPlayer());
        assertEquals("SlotID: "+slotID+"\nNUpper: "+s.getNUpper()+"\nNLower: "+s.getNLower()+"\nFood: "+s.getFood()+"\nNMinPlayer: "+s.getNMinPlayer()+"\n", s.toString());
    }

    @Test
    void SlotIdG() {
        char slotID = 'G';
        Slot s = new Slot(slotID);
        assertEquals(slotID, s.getSlotId());
        assertEquals('G', s.getSlotId());
        assertEquals(0, s.getFood());
        assertEquals(1, s.getNLower());
        assertEquals(2, s.getNUpper());
        assertEquals(4, s.getNMinPlayer());
        assertEquals("SlotID: "+slotID+"\nNUpper: "+s.getNUpper()+"\nNLower: "+s.getNLower()+"\nFood: "+s.getFood()+"\nNMinPlayer: "+s.getNMinPlayer()+"\n", s.toString());
    }
}