public void UserJoinToEventTest() { authService.createNewUser(constants.getUser().Name, constants.getUser().Password); int userId = userService.getIdByNameAndPassword(constants.getNameAndPass()); eventService.createNewEvent(constants.getTestEvent().title, constants.getTestEvent().summary, constants.getTestEvent().CreatedBy); int eventId = eventService.getEventIdByTitleAndAuthor(constants.getTestEvent().title, constants.getTestEvent().CreatedBy); userEventsService.joinUserToEvent(userId, eventId); Assert.NotNull(userEventsService.getEventByUserIdAndEventId(userId, eventId)); userEventsService.deleteUserEvent(userId, eventId); Assert.Null(userEventsService.getEventByUserIdAndEventId(userId, eventId)); }
public void clearDB() { while (userService.getUserByNameAndPassword(testConstants.getUser().Name, testConstants.getUser().Password) != null) { userService.deleteUserById(userService.getIdByNameAndPassword(new string[] { testConstants.getUser().Name, testConstants.getUser().Password })); } while (eventService.getEventByTitleAndAuthor(testConstants.getTestEvent().title, testConstants.getTestEvent().CreatedBy) != null) { eventService.deleteEvent(eventService.getEventIdByTitleAndAuthor(testConstants.getTestEvent().title, testConstants.getTestEvent().CreatedBy)); } }
public void UserContainsToList() { User user = authService.createNewUser(constants.getUser().Name, constants.getUser().Password); Assert.True(userService.getAllUsers().Find(x => x.Name == user.Name && x.Password == user.Password) != null); }