package de.jeyp91.googlecalendar;

import com.google.api.client.util.DateTime;
import com.google.api.services.calendar.model.Event;
import de.jeyp91.tippliga.TLWMatchday;
import org.junit.Test;

import java.util.List;
import static org.junit.Assert.assertEquals;

public class GoogleCalendarConnectorTest {

    @Test
    public void getAllEventsStartingFromDateTimeTest()
    {
        DateTime dateTime = new DateTime("2020-01-01T00:00:00");

        List<Event> events = GoogleCalendarConnector.getAllEventsStartingFromDateTime(1, dateTime);

        assertEquals("Tippliga 20. Spieltag tippen!", events.get(0).getSummary());
        DateTime startExpected = new DateTime("2020-01-17T20:30:00+01:00");
        DateTime startActual = events.get(0).getStart().getDateTime();
        assertEquals(startExpected, startActual);

        assertEquals("Tippliga 21. Spieltag tippen!", events.get(1).getSummary());
        startExpected = new DateTime("2020-01-24T20:30:00+01:00");
        startActual = events.get(1).getStart().getDateTime();
        assertEquals(startExpected, startActual);
    }

    @Test
    public void createEventTest() {
        TLWMatchday matchday = new TLWMatchday(2020, 1, 1, 0, "2020-07-01 20:30:00", "", "", "", 1);
        // GoogleCalendarConnector.createNewEvent(matchday);
    }
}
