public void Post_CalledWithId_ReturnsReponseWithId() { // Given var response = new OrganizationMembershipResponse { Item = new OrganizationMembership { Id = 123 } }; var request = new OrganizationMembershipRequest { Item = new OrganizationMembership { Id = 123 } }; _client.Setup(b => b.Post <OrganizationMembershipResponse>( It.IsAny <Uri>(), request, "application/json", It.IsAny <string>(), It.IsAny <string>())) .Returns(response); var organizationMembershipResource = new OrganizationMembershipResource(_client.Object); // When var result = organizationMembershipResource.Post(request); // Then Assert.That(result, Is.EqualTo(response)); }
public void Post_CalledWithId_ReturnsReponseWithId() { // Given var response = new OrganizationMembershipResponse { Item = new OrganizationMembership { Id = 123 } }; var request = new OrganizationMembershipRequest { Item = new OrganizationMembership { Id = 123 } }; _client.Setup(b => b.Post<OrganizationMembershipResponse>(It.IsAny<Uri>(), request, "application/json")).Returns(response); var organizationMembershipResource = new OrganizationMembershipResource(_client.Object); // When var result = organizationMembershipResource.Post(request); // Then Assert.That(result, Is.EqualTo(response)); }
public async void PostAsync_CalledWithId_ReturnsReponseWithId() { // Given var response = new OrganizationMembershipResponse { Item = new OrganizationMembership { Id = 123 } }; var request = new OrganizationMembershipRequest { Item = new OrganizationMembership { Id = 123 } }; _client.Setup(b => b.PostAsync <OrganizationMembershipResponse>(It.IsAny <Uri>(), request, "application/json")).Returns(TaskHelper.CreateTaskFromResult(response)); var organizationMembershipResource = new OrganizationMembershipResource(_client.Object); // When var result = await organizationMembershipResource.PostAsync(request); // Then Assert.That(result, Is.EqualTo(response)); }
public async void PostAsync_CalledWithId_ReturnsReponseWithId() { // Given var response = new OrganizationMembershipResponse { Item = new OrganizationMembership { Id = 123 } }; var request = new OrganizationMembershipRequest { Item = new OrganizationMembership { Id = 123 } }; _client.Setup(b => b.PostAsync<OrganizationMembershipResponse>(It.IsAny<Uri>(), request, "application/json", It.IsAny<string>(), It.IsAny<string>())).Returns(TaskHelper.CreateTaskFromResult(response)); var organizationMembershipResource = new OrganizationMembershipResource(_client.Object); // When var result = await organizationMembershipResource.PostAsync(request); // Then Assert.That(result, Is.EqualTo(response)); }