public async Task PatchAsJsonAsync_WithValidParams_ShouldMakeAPatchRequestToResource() { //Arrange var arrangements = new Arrangements(); var payload = new { Value = 5, Name = "MyName" }; //Act using (arrangements.StartServer()) using (var client = arrangements.GetClient()) { await client.PatchAsJsonAsync("capture", payload); } //Arrange var request = arrangements.Requests[0]; request.Method.Should().BeEquivalentTo("patch"); }
public async Task PatchAsJsonAsync_WithValidParams_RequestShouldBeJson() { //Arrange var arrangements = new Arrangements(); var payload = new { Value = 5, Name = "MyName" }; //Act using (arrangements.StartServer()) using (var client = arrangements.GetClient()) { await client.PatchAsJsonAsync("capture", payload); } //Arrange var request = arrangements.Requests[0]; request.ContentType.Should().BeEquivalentTo("application/json; charset=utf-8"); }
public async Task PatchAsJsonAsync_WithValidParams_RequestShouldIncludePayload() { //Arrange var arrangements = new Arrangements(); var payload = new { Value = 5, Name = "MyName" }; //Act using (arrangements.StartServer()) using (var client = arrangements.GetClient()) { await client.PatchAsJsonAsync("capture", payload); } //Arrange var request = arrangements.Requests[0]; var receivedPayload = JsonConvert.DeserializeAnonymousType(request.Payload, payload); receivedPayload.Value.Should().Be(payload.Value); receivedPayload.Name.Should().Be(payload.Name); }
public async Task PatchAsJsonAsync_WithValidParams_ShouldMakeExactlyOneRequestToResource() { //Arrange var arrangements = new Arrangements(); var payload = new { Value = 5, Name = "MyName" }; //Act using (arrangements.StartServer()) using (var client = arrangements.GetClient()) { await client.PatchAsJsonAsync("capture", payload); } //Arrange arrangements.Requests.Should().NotBeEmpty(); arrangements.Requests.Count.Should().Be(1); var request = arrangements.Requests[0]; request.Resource.Should().EndWith("capture"); }