public T Verify(params HttpRequest[] httpRequests) { if (httpRequests == null || httpRequests.Length == 0 || httpRequests[0] == null) { throw new ArgumentException("Required: Non-Null and Non-Empty array of requests"); } var sequence = new VerificationSequence().WithRequests(httpRequests); var res = SendRequest(new HttpRequestMessage() .WithMethod("PUT") .WithPath(CalculatePath("verifySequence")) .WithBody(VerificationSequenceSerializer.Serialize(sequence), Encoding.UTF8)); var body = res?.Content.ReadAsStringAsync().Result; if (!string.IsNullOrEmpty(body)) { throw new AssertionException(body); } return((T)this); }
public async Task <MockServerClient> VerifyAsync(params HttpRequest[] httpRequests) { if (httpRequests.IsNullOrEmpty()) { throw new ArgumentException("Required: Non-Null and Non-Empty array of requests"); } var sequence = new VerificationSequence().WithRequests(httpRequests); var response = await SendRequestAsync(new HttpRequestMessage() .WithMethod(HttpMethod.Put) .WithUri(ServerAddress(FullPath(VerifySequenceEndpoint))) .WithBody(_verificationSequenceSerializer.Serialize(sequence), Encoding.UTF8)); var body = await response.Content.ReadAsStringAsync(); if (!body.IsNullOrEmpty()) { throw new AssertionException(body); } return(this); }