public void UT_User_Comments() { var repo = new mockUserRepositoryUserExists(); var service = new UserCommentsV1(repo); var dto = service.Exec(null, new AuthenticatedUser(), 0, 1); if (dto.total != 1) { Assert.Fail("dto.total"); } if (dto.list.Count != 1) { Assert.Fail("dto.list"); } }
public ActionResult <string> Comments(int skip, int take) { try { using (var db = new SqlConnection(GetDBConnectionString())) { var service = new UserCommentsV1(userRepository); var resp = service.Exec(db, GetCurrentAuthenticatedUser(), skip, take); return(Ok(JsonConvert.SerializeObject(resp))); } } catch (System.Exception ex) { return(BadRequest(new ServiceError { DebugInfo = ex.ToString(), Message = _defaultError })); } }