use of org.fossasia.openevent.app.data.models.Event in project open-event-orga-app by fossasia.
the class CreateEventPresenterTest method shouldNullifyEmptyFields.
@Test
public void shouldNullifyEmptyFields() {
Event event = createEventPresenter.getEvent();
when(eventRepository.createEvent(event)).thenReturn(Observable.just(event));
event.setLogoUrl("");
event.setTicketUrl("");
event.setOriginalImageUrl("");
event.setExternalEventUrl("");
event.setPaypalEmail("");
String isoDateNow = DateUtils.formatDateToIso(LocalDateTime.now());
String isoDateMax = DateUtils.formatDateToIso(LocalDateTime.MAX);
event.getStartsAt().set(isoDateNow);
event.getEndsAt().set(isoDateMax);
createEventPresenter.createEvent();
assertNull(event.getLogoUrl());
assertNull(event.getTicketUrl());
assertNull(event.getOriginalImageUrl());
assertNull(event.getExternalEventUrl());
assertNull(event.getPaypalEmail());
}
use of org.fossasia.openevent.app.data.models.Event in project open-event-orga-app by fossasia.
the class CreateEventPresenterTest method shouldRejectWrongFormatDates.
@Test
public void shouldRejectWrongFormatDates() {
createEventPresenter.createEvent();
Event event = createEventPresenter.getEvent();
event.getStartsAt().set("2011/12/03");
event.getEndsAt().set("2011/03/03");
createEventPresenter.createEvent();
verify(createEventView).showError("Please enter date in correct format");
verify(eventRepository, never()).createEvent(any());
}
use of org.fossasia.openevent.app.data.models.Event in project open-event-orga-app by fossasia.
the class CreateEventPresenterTest method shouldAcceptCorrectEventDates.
@Test
public void shouldAcceptCorrectEventDates() {
Event event = createEventPresenter.getEvent();
when(eventRepository.createEvent(event)).thenReturn(Observable.empty());
String isoDateNow = DateUtils.formatDateToIso(LocalDateTime.now());
String isoDateMax = DateUtils.formatDateToIso(LocalDateTime.MAX);
event.getStartsAt().set(isoDateNow);
event.getEndsAt().set(isoDateMax);
createEventPresenter.createEvent();
verify(createEventView, never()).showError(anyString());
verify(eventRepository).createEvent(event);
}
use of org.fossasia.openevent.app.data.models.Event in project open-event-orga-app by fossasia.
the class EventDashboardPresenterTest method shouldHideProgressbarOnToggleSuccess.
@Test
public void shouldHideProgressbarOnToggleSuccess() {
when(eventRepository.updateEvent(any(Event.class))).thenReturn(Observable.just(TOGGLED_EVENT));
eventDashboardPresenter.setEvent(EVENT);
eventDashboardPresenter.toggleState();
InOrder inOrder = Mockito.inOrder(eventDetailView, eventRepository);
inOrder.verify(eventRepository).updateEvent(any(Event.class));
inOrder.verify(eventDetailView).showProgress(true);
inOrder.verify(eventDetailView).showResult(any(Event.class));
inOrder.verify(eventDetailView).showProgress(false);
}
use of org.fossasia.openevent.app.data.models.Event in project open-event-orga-app by fossasia.
the class DateServiceTest method testClashPast.
@Test
public void testClashPast() {
Event pastLatest = new Event();
String min = DateUtils.formatDateToIso(LocalDateTime.MIN);
String minPlus5 = DateUtils.formatDateToIso(LocalDateTime.MIN.plusDays(5));
pastLatest.setStartsAt(new ObservableString(min));
pastLatest.setEndsAt(new ObservableString(minPlus5));
assertEquals(1, DateService.compareEventDates(PAST, pastLatest));
}
Aggregations