use of com.eventyay.organizer.data.event.Event in project open-event-orga-app by fossasia.
the class CreateTicketViewModel method createTicket.
public void createTicket() {
if (!verify())
return;
long eventId = ContextManager.getSelectedEvent().getId();
Event event = new Event();
event.setId(eventId);
ticket.setEvent(event);
compositeDisposable.add(ticketRepository.createTicket(ticket).doOnSubscribe(disposable -> progress.setValue(true)).doFinally(() -> progress.setValue(false)).subscribe(createdTicket -> {
success.setValue("Ticket Created");
dismiss.call();
}, throwable -> error.setValue(ErrorUtils.getMessage(throwable).toString())));
}
use of com.eventyay.organizer.data.event.Event in project open-event-orga-app by fossasia.
the class EventRepositoryTest method shouldFetchEventOnForceReload.
@Test
public void shouldFetchEventOnForceReload() {
long id = 45L;
Event event = new Event();
when(repository.save(Event.class, event)).thenReturn(Completable.complete());
when(repository.getItems(eq(Event.class), refEq(Event_Table.id.eq(id)))).thenReturn(Observable.just(event));
when(repository.isConnected()).thenReturn(true);
when(eventApi.getEvent(id)).thenReturn(Observable.just(event));
// Force reload ensures no use of cache
Observable<Event> userObservable = eventRepository.getEvent(id, true);
userObservable.test().assertValue(event);
// Verify loads from network
verify(eventApi).getEvent(id);
}
use of com.eventyay.organizer.data.event.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(min);
pastLatest.setEndsAt(minPlus5);
assertEquals(1, DateService.compareEventDates(PAST, pastLatest));
}
use of com.eventyay.organizer.data.event.Event in project open-event-orga-app by fossasia.
the class DateServiceTest method testClashLive.
@Test
public void testClashLive() {
Event liveLatest = new Event();
String nowMinus5 = DateUtils.formatDateToIso(LocalDateTime.now().minusDays(5));
String nowPlus5 = DateUtils.formatDateToIso(LocalDateTime.now().plusDays(5));
liveLatest.setStartsAt(nowMinus5);
liveLatest.setEndsAt(nowPlus5);
assertEquals(1, DateService.compareEventDates(LIVE, liveLatest));
}
use of com.eventyay.organizer.data.event.Event in project open-event-orga-app by fossasia.
the class DateServiceTest method testClashUpcoming.
@Test
public void testClashUpcoming() {
Event upcomingEarliest = new Event();
String max = DateUtils.formatDateToIso(LocalDateTime.MAX);
String maxMinus5 = DateUtils.formatDateToIso(LocalDateTime.MAX.minusDays(5));
upcomingEarliest.setStartsAt(maxMinus5);
upcomingEarliest.setEndsAt(max);
assertEquals(1, DateService.compareEventDates(UPCOMING, upcomingEarliest));
}
Aggregations