예제 #1
0
        public void AddAndDeleteSupport()
        {
            supportService.AddSupportToDatabase(constants.getSupport());
            int id = supportService.GetSupportByTitleAndAuthor(constants.getSupport().Title, constants.getSupport().WritenBy);

            Assert.NotNull(supportService.getSupportById(id));

            supportService.deleteSupportFromDatabase(id);

            Assert.Null(supportService.getSupportById(id));
        }
예제 #2
0
 public ActionResult createSupportMessage([FromBody] Support support)
 {
     if (validationService.idValdation(support.WritenBy) &&
         validationService.textValidation(support.Title) &&
         validationService.textValidation(support.Summary))
     {
         if (validationService.objectValidation(support))
         {
             supportService.AddSupportToDatabase(support);
             return(Created("", support));
         }
         return(NotFound(ErrorService.GetError("User can not be found")));
     }
     return(NotFound(ErrorService.GetError("UserId, Title and summary can not be empty")));
 }
예제 #3
0
        public void deleteUser()
        {
            authService.createNewUser(constants.getUser().Name, constants.getUser().Password);
            int id = userService.getIdByNameAndPassword(constants.getNameAndPass());

            eventService.createNewEvent(constants.getTestEvent().title, constants.getTestEvent().summary, id);
            int eventId = eventService.getEventIdByTitleAndAuthor(constants.getTestEvent().title, id);

            supportService.AddSupportToDatabase(new Support(constants.getSupport().Title, constants.getSupport().Summary, id));
            userEventsService.joinUserToEvent(id, eventId);

            userService.deleteUserById(id);

            Assert.Null(userService.getUserById(id));
        }