public void Delete_NonExistUser_ShouldReturnNotFound() { //arrange User user = TestDataHelper.GenerateUser(); var userController = new UserController(TestDataHelper.GetIUserRepositoryMock(null)); //act IHttpActionResult response = userController.Delete(user.Id); //assert Assert.IsTrue(response is NotFoundResult); }
public void Create_WithNullUserObject_ShouldReturnBadRequest() { //arrange User user = null; var userController = new UserController(TestDataHelper.GetIUserRepositoryMock(user)); //act IHttpActionResult response = userController.Create(user); //assert Assert.IsTrue(response is BadRequestErrorMessageResult); }
public void Create_ShouldReturnCreated() { //arrange User user = TestDataHelper.GenerateUser(); var userController = new UserController(TestDataHelper.GetIUserRepositoryMock(null)); //act IHttpActionResult response = userController.Create(user); //assert Assert.IsTrue(response is CreatedNegotiatedContentResult<User>); }
public void Delete_ShouldReturnOk() { //arrange User user = TestDataHelper.GenerateUser(); var userController = new UserController(TestDataHelper.GetIUserRepositoryMock(user)); //act userController.Create(user); IHttpActionResult response = userController.Delete(user.Id); //assert Assert.IsTrue(response is OkResult); }
public void Update_WithNullField_ShouldReturnBadRequest() { //arrange User user = TestDataHelper.GenerateUser(); user.Email = null; var userController = new UserController(TestDataHelper.GetIUserRepositoryMock(user)); //act IHttpActionResult response = userController.Update(user); //assert Assert.IsTrue(response is BadRequestErrorMessageResult); }
public void Get_ById_ShouldReturnOk() { //arrange User user = TestDataHelper.GenerateUser(); var userController = new UserController(TestDataHelper.GetIUserRepositoryMock(user)); //act IHttpActionResult response = userController.Get(user.Id.ToString()); //assert Assert.IsTrue(response is OkNegotiatedContentResult<User>); }