public async void PutAsync_Called_BuildsUri() { // Given var request = new UserRequest { Item = new User { Name = "Owner Name", Id = 123 } }; var userResource = new UserResource(_client.Object); // When await userResource.PutAsync(request); // Then _client.Setup(b => b.BuildUri(It.IsAny <string>(), "")); }
public async void PutAsync_CalledWithUser_ReturnsUserReponse() { // Given var response = new UserResponse { Item = new User { Name = "Owner Name" } }; var request = new UserRequest { Item = new User { Name = "Owner Name", Id = 123 } }; _client.Setup(b => b.PutAsync <UserResponse>(It.IsAny <Uri>(), request, "application/json")).Returns(TaskHelper.CreateTaskFromResult(response)); var userResource = new UserResource(_client.Object); // When var result = await userResource.PutAsync(request); // Then Assert.That(result, Is.EqualTo(response)); }