public async Task ReturnsAReview() { int expectedId = 2153; var review = await ReviewsEndpoint.GetById(expectedId); Assert.NotNull(review); Assert.Equal(review.Id, expectedId); }
public async Task EditReviewTextSucceeds() { const long EditReviewId = 2175139156; var expectedNewText = "test_" + _rand.Next(); var result = await ReviewsEndpoint.Edit(EditReviewId, expectedNewText, null, null, null); Assert.True(result); var reviewAfterEdit = await ReviewsEndpoint.GetById(EditReviewId); var actualNewText = reviewAfterEdit.Body.Trim(); Assert.Equal(expectedNewText, actualNewText); }
public async Task EditRatingSucceeds() { const long EditReviewId = 1700138017; var reviewBeforeEdit = await ReviewsEndpoint.GetById(EditReviewId); var ratingBeforeEdit = reviewBeforeEdit.Rating; var expectedNewRating = ratingBeforeEdit == 5 ? 4 : 5; var result = await ReviewsEndpoint.Edit(EditReviewId, string.Empty, expectedNewRating, null, null); Assert.True(result); var reviewAfterEdit = await ReviewsEndpoint.GetById(EditReviewId); var actualRatingAfterEdit = reviewAfterEdit.Rating; Assert.Equal(expectedNewRating, actualRatingAfterEdit); }
public async Task EditReadDateSucceeds() { const long EditReviewId = 2034600714; var reviewBeforeEdit = await ReviewsEndpoint.GetById(EditReviewId); var dateBeforeEdit = reviewBeforeEdit.DateRead; var expectedNewDate = dateBeforeEdit.GetValueOrDefault().Date >= DateTime.UtcNow.Date ? DateTime.UtcNow.Date.AddDays(-7) : DateTime.UtcNow.Date; var result = await ReviewsEndpoint.Edit(EditReviewId, string.Empty, null, expectedNewDate, null); Assert.True(result); var reviewAfterEdit = await ReviewsEndpoint.GetById(EditReviewId); var actualNewDate = reviewAfterEdit.DateRead; Assert.NotNull(actualNewDate); Assert.True(dateBeforeEdit.Value.Date != actualNewDate.Value.Date); }