public async void PostAsync_CalledWithRating_ReturnsUserReponse() { // Given var client = new Mock <IRestClient>(); var response = new SatisfactionRatingResponse { Item = new SatisfactionRating { Score = SatisfactionRatingScore.good } }; var request = new SatisfactionRatingRequest { Item = new SatisfactionRating { Score = SatisfactionRatingScore.good } }; client.Setup(b => b.PostAsync <SatisfactionRatingResponse>( It.IsAny <Uri>(), request, "application/json", It.IsAny <string>(), It.IsAny <string>())) .Returns(TaskHelper.CreateTaskFromResult(response)); var resource = new SatisfactionRatingResource(client.Object); // When var result = await resource.PostAsync(request, 21); // Then Assert.Equal(result, response); }
public async void PostAsync_Called_BuildsUri() { // Given var request = new SatisfactionRatingRequest { Item = new SatisfactionRating { Score = SatisfactionRatingScore.good } }; var resource = new SatisfactionRatingResource(_client.Object); // When await resource.PostAsync(request, 231); // Then _client.Setup(b => b.BuildUri(It.IsAny <string>(), "")); }
public async void PostAsync_CalledWithRating_ReturnsUserReponse() { // Given var response = new SatisfactionRatingResponse { Item = new SatisfactionRating { Score = SatisfactionRatingScore.good } }; var request = new SatisfactionRatingRequest { Item = new SatisfactionRating { Score = SatisfactionRatingScore.good } }; _client.Setup(b => b.PostAsync<SatisfactionRatingResponse>( It.IsAny<Uri>(), request, "application/json", It.IsAny<string>(), It.IsAny<string>())) .Returns(TaskHelper.CreateTaskFromResult(response)); var resource = new SatisfactionRatingResource(_client.Object); // When var result = await resource.PostAsync(request, 21); // Then Assert.That(result, Is.EqualTo(response)); }
public async void PostAsync_Called_BuildsUri() { // Given var request = new SatisfactionRatingRequest { Item = new SatisfactionRating { Score = SatisfactionRatingScore.good } }; var resource = new SatisfactionRatingResource(_client.Object); // When await resource.PostAsync(request, 231); // Then _client.Setup(b => b.BuildUri(It.IsAny<string>(), "")); }