public async Task EditRatingSucceeds() { var reviewBeforeEdit = await ReviewsClient.GetById(EditReviewId); var ratingBeforeEdit = reviewBeforeEdit.Rating; var expectedNewRating = ratingBeforeEdit == 5 ? 4 : 5; var result = await ReviewsClient.Edit(EditReviewId, rating : expectedNewRating); Assert.True(result); var reviewAfterEdit = await ReviewsClient.GetById(EditReviewId); var actualRatingAfterEdit = reviewAfterEdit.Rating; Assert.Equal(expectedNewRating, actualRatingAfterEdit); }
public async Task EditReadDateSucceeds() { var reviewBeforeEdit = await ReviewsClient.GetById(EditReviewId); var dateBeforeEdit = reviewBeforeEdit.DateRead; var expectedNewDate = dateBeforeEdit.Value.Date >= DateTime.UtcNow.Date ? DateTime.UtcNow.Date.AddDays(-7) : DateTime.UtcNow.Date; var result = await ReviewsClient.Edit(EditReviewId, dateRead : expectedNewDate); Assert.True(result); var reviewAfterEdit = await ReviewsClient.GetById(EditReviewId); var actualNewDate = reviewAfterEdit.DateRead; Assert.NotNull(actualNewDate); Assert.True(dateBeforeEdit.Value.Date != actualNewDate.Value.Date); }
public async Task EditReviewTextSucceeds() { var reviewBeforeEdit = await ReviewsClient.GetById(EditReviewId); var textBeforeEdit = reviewBeforeEdit.Body.Trim(); var match = Regex.Match(textBeforeEdit, @".*(\d+)"); var testNumber = int.Parse(match.Groups[1].Value); var expectedNewText = textBeforeEdit.Replace(testNumber.ToString(), (testNumber + 1).ToString()); var result = await ReviewsClient.Edit(EditReviewId, reviewText : expectedNewText); Assert.True(result); var reviewAfterEdit = await ReviewsClient.GetById(EditReviewId); var actualNewText = reviewAfterEdit.Body.Trim(); Assert.Equal(expectedNewText, actualNewText); }