public async Task ShouldReturnCreatedAtStatusCodeOnCallCreateReview() { User user = await InsertUserOnDatabase(); _httpClient.InsertAuthorizationTokenOnRequestHeader(_authorizationTokenHelper.CreateToken(user.Id)); HttpResponseMessage response = await _httpClient.PostAsync("../reviews", CreateReviewMultipartFormContent()); Assert.Equal((int)HttpStatusCode.Created, (int)response.StatusCode); }
public async Task ShouldReturnBadRequestOnCallUpdateInNotExistsReview() { User user = await InsertUserOnDatabase(); _httpClient.InsertAuthorizationTokenOnRequestHeader(_authorizationTokenHelper.CreateToken(user.Id)); HttpResponseMessage response = await _httpClient.PutAsync($"../reviews/{Guid.NewGuid().ToString()}/favorites", null); Assert.Equal((int)HttpStatusCode.BadRequest, (int)response.StatusCode); }
public async Task ShouldReturnOkOnCallUpdateUserName() { Guid id = await InsertUserOnDatabase(); _httpClient.InsertAuthorizationTokenOnRequestHeader(_authorizationTokenHelper.CreateToken(id)); UpdateNameUserRequestModel model = new UpdateNameUserRequestModel() { Name = "User Name" }; HttpResponseMessage httpResponse = await _httpClient.PutAsync("../users/name", _createRequestHelper.CreateStringContent(model)); Assert.Equal((int)HttpStatusCode.OK, (int)httpResponse.StatusCode); }
public async Task ShouldCreateComment() { User insertedUser = await InsertUserOnDatabase(); Review insertedReview = await InsertReviewOnDatabase(insertedUser.Id); _httpClient.InsertAuthorizationTokenOnRequestHeader(_authorizationTokenHelper.CreateToken(insertedUser.Id)); CreateCommentRequestModel requestModel = new CreateCommentRequestModel() { Text = "TEXT" }; HttpResponseMessage response = await _httpClient.PostAsync($"../reviews/{insertedReview.Id.ToString()}/comments", _createRequestHelper.CreateStringContent(requestModel)); Assert.Equal((int)HttpStatusCode.Created, (int)response.StatusCode); }