public void Post_Called_BuildsUri() { // Given var request = new UserRequest { Item = new User { Name = "Owner Name" } }; var userResource = new UserResource(_client.Object); // When userResource.Post(request); // Then _client.Setup(b => b.BuildUri(It.IsAny <string>(), "")); }
public void Post_CalledWithUser_ReturnsUserReponse() { // Given var response = new UserResponse { Item = new User { Name = "Owner Name" } }; var request = new UserRequest { Item = new User { Name = "Owner Name" } }; _client.Setup(b => b.Post <UserResponse>(It.IsAny <Uri>(), request, "application/json")).Returns(response); var userResource = new UserResource(_client.Object); // When var result = userResource.Post(request); // Then Assert.That(result, Is.EqualTo(response)); }
public void Post_CalledWithUser_ReturnsUserReponse() { // Given var response = new UserResponse { Item = new User { Name = "Owner Name" } }; var request = new UserRequest { Item = new User { Name = "Owner Name" } }; _client.Setup(b => b.Post<UserResponse>(It.IsAny<Uri>(), request, "application/json")).Returns(response); var userResource = new UserResource(_client.Object); // When var result = userResource.Post(request); // Then Assert.That(result, Is.EqualTo(response)); }
public void Post_Called_BuildsUri() { // Given var request = new UserRequest { Item = new User { Name = "Owner Name" } }; var userResource = new UserResource(_client.Object); // When userResource.Post(request); // Then _client.Setup(b => b.BuildUri(It.IsAny<string>(), "")); }