package com.company;
import org.junit.Test;
import org.junit.jupiter.api.BeforeAll;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;

public class CustomerTest {
    static Operator operator = new Operator();
    static Customer customer = new Customer(1212 , operator);

    @BeforeAll
    public void creatCustomer(){
        operator = new Operator();
        int ID = 1212;
        customer = new Customer(ID , operator);
    }

    @Test
    public void testGetBalance(){
        operator = new Operator();
        int ID = 1212;
        customer = new Customer(ID , operator);
        assertEquals(0 , customer.getBalance());
    }

    @Test
    public void testAddBalance(){
        operator = new Operator();
        int ID = 1212;
        customer = new Customer(ID , operator);
        customer.addBalance(1000);
        assertEquals(1000 , customer.getBalance());
    }

    @Test
    public void testGetID(){
        operator = new Operator();
        int ID = 1212;
        customer = new Customer(ID , operator);
        assertEquals(1212 , customer.getID());
    }

    @Test
    public void testReserve(){
        operator = new Operator();
        int ID = 1212;
        customer = new Customer(ID , operator);
        Seat seat = new Seat("common" , 12);
        Airplain airplain = new Airplain("booing");
        airplain.setSeat(seat);
        Flight flight = new Flight("98,3,1" , "15" , 123 , "Tehran" , "Boushehr" , airplain , "gheshmair");
        operator.addFlight(flight);
        assertEquals(123 , customer.reserve(123 , 12 , 20 , 300 , true).getFlightNo());
    }
}
