public void UserIsFollowed() { Usuarios_Seguidos rel = new Usuarios_Seguidos { UserId = 1, UserFollowedId = 2 }; bool actual = Usuarios_SeguidosHelper.UserIsFollowed(rel); bool expected = false; Assert.AreEqual(expected, actual); }
public void FollowUser() { Usuarios_Seguidos rel = new Usuarios_Seguidos { UserId = 1, UserFollowedId = 2 }; bool actual = Usuarios_SeguidosHelper.Save(rel); bool expected = true; Assert.AreEqual(expected, actual); }
public HttpResponseMessage FollowUser([FromBody] Usuarios_Seguidos rel) { if (Usuarios_SeguidosHelper.UserIsFollowed(rel)) { throw new HttpResponseException(HttpStatusCode.Conflict); } bool result = UsuariosHelper.FollowUser(rel); if (!result) { throw new HttpResponseException(HttpStatusCode.InternalServerError); } return(Request.CreateResponse(HttpStatusCode.Created)); }
public HttpResponseMessage UserFollowed([FromBody] Usuarios_Seguidos rel) { bool modelIsNull = rel == null; if (modelIsNull) { throw new HttpResponseException(HttpStatusCode.BadRequest); } bool result = Usuarios_SeguidosHelper.UserIsFollowed(rel); if (result) { throw new HttpResponseException(HttpStatusCode.Conflict); } return(Request.CreateResponse(HttpStatusCode.Accepted)); }