public void Put_HasNoId_ThrowsException() { // Given var response = new OrganizationResponse { Item = new Organization { Name = "blah blah" } }; var request = new OrganizationRequest { Item = new Organization { Name = "blah blah" } }; _client.Setup(b => b.Put <OrganizationResponse>( It.IsAny <Uri>(), request, "application/json", It.IsAny <string>(), It.IsAny <string>())) .Returns(response); var resource = new OrganizationResource(_client.Object); // When, Then Assert.Throws <ArgumentException>(() => resource.Put(request)); }
public void Put_CalledWithItem_ReturnsReponse() { // Given var response = new OrganizationResponse { Item = new Organization { Name = "blah blah" } }; var request = new OrganizationRequest { Item = new Organization { Name = "blah blah", Id = 123 } }; _client.Setup(b => b.Put <OrganizationResponse>( It.IsAny <Uri>(), request, "application/json", It.IsAny <string>(), It.IsAny <string>())) .Returns(response); var resource = new OrganizationResource(_client.Object); // When var result = resource.Put(request); // Then Assert.That(result, Is.EqualTo(response)); }
public void Put_Called_BuildsUri() { // Given var request = new OrganizationRequest { Item = new Organization { Name = "Organizations", Id = 123 } }; var resource = new OrganizationResource(_client.Object); // When resource.Put(request); // Then _client.Setup(b => b.BuildUri(It.IsAny<string>(), "")); }
public void Put_CalledWithItem_ReturnsReponse() { // Given var response = new OrganizationResponse { Item = new Organization { Name = "blah blah" } }; var request = new OrganizationRequest { Item = new Organization { Name = "blah blah", Id = 123 } }; _client.Setup(b => b.Put<OrganizationResponse>(It.IsAny<Uri>(), request, "application/json")).Returns(response); var resource = new OrganizationResource(_client.Object); // When var result = resource.Put(request); // Then Assert.That(result, Is.EqualTo(response)); }
public void Put_Called_BuildsUri() { // Given var request = new OrganizationRequest { Item = new Organization { Name = "Organizations", Id = 123 } }; var resource = new OrganizationResource(_client.Object); // When resource.Put(request); // Then _client.Setup(b => b.BuildUri(It.IsAny <string>(), "")); }
public void Put_HasNoId_ThrowsException() { // Given var response = new OrganizationResponse { Item = new Organization { Name = "blah blah" } }; var request = new OrganizationRequest { Item = new Organization { Name = "blah blah" } }; _client.Setup(b => b.Put<OrganizationResponse>( It.IsAny<Uri>(), request, "application/json", It.IsAny<string>(), It.IsAny<string>())) .Returns(response); var resource = new OrganizationResource(_client.Object); // When, Then Assert.Throws<ArgumentException>(() => resource.Put(request)); }