public async void PutAsync_Called_BuildsUri()
        {
            // Given
            var request = new TicketRequest {
                Item = new Ticket {
                    Subject = "blah blah", Id = 123
                }
            };
            var ticketResource = new TicketResource(_client.Object);

            // When
            await ticketResource.PutAsync(request);

            // Then
            _client.Setup(b => b.BuildUri(It.IsAny <string>(), ""));
        }
        public void PutAsync_TicketHasNoId_ThrowsException()
        {
            // Given
            var response = new TicketResponse {
                Item = new Ticket {
                    Subject = "blah blah"
                }
            };
            var request = new TicketRequest {
                Item = new Ticket {
                    Subject = "blah blah"
                }
            };

            _client.Setup(b => b.PutAsync <TicketResponse>(It.IsAny <Uri>(), request, "application/json")).Returns(TaskHelper.CreateTaskFromResult(response));
            var ticketResource = new TicketResource(_client.Object);

            // When, Then
            Assert.Throws <ArgumentException>(async() => await ticketResource.PutAsync(request));
        }
        public async void PutAsync_CalledWithTicket_ReturnsTicketReponse()
        {
            // Given
            var response = new TicketResponse {
                Item = new Ticket {
                    Subject = "blah blah"
                }
            };
            var request = new TicketRequest {
                Item = new Ticket {
                    Subject = "blah blah", Id = 123
                }
            };

            _client.Setup(b => b.PutAsync <TicketResponse>(It.IsAny <Uri>(), request, "application/json")).Returns(TaskHelper.CreateTaskFromResult(response));
            var ticketResource = new TicketResource(_client.Object);

            // When
            var result = await ticketResource.PutAsync(request);

            // Then
            Assert.That(result, Is.EqualTo(response));
        }