public async void PostAsync_Called_BuildsUri() { // Given var request = new TicketRequest { Item = new Ticket { Subject = "blah blah" } }; var ticketResource = new TicketResource(_client.Object); // When await ticketResource.PostAsync(request); // Then _client.Setup(b => b.BuildUri(It.IsAny <string>(), "")); }
public async void PostAsync_CalledWithTicket_ReturnsTicketReponse() { // 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.PostAsync <TicketResponse>(It.IsAny <Uri>(), request, "application/json")).Returns(TaskHelper.CreateTaskFromResult(response)); var ticketResource = new TicketResource(_client.Object); // When var result = await ticketResource.PostAsync(request); // Then Assert.That(result, Is.EqualTo(response)); }