Esempio n. 1
0
        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);
        }
Esempio n. 2
0
        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);
        }
Esempio n. 3
0
        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));
        }
Esempio n. 4
0
        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));
        }