mirror of
https://github.com/wiremock/WireMock.Net.git
synced 2026-04-22 16:58:58 +02:00
ct
This commit is contained in:
@@ -17,6 +17,8 @@ namespace WireMock.Net.Tests;
|
||||
|
||||
public class WireMockServerWebhookTests
|
||||
{
|
||||
private readonly CancellationToken _ct = TestContext.Current.CancellationToken;
|
||||
|
||||
[Fact]
|
||||
public async Task WireMockServer_WithWebhooks_Should_Send_Message_To_Webhooks()
|
||||
{
|
||||
@@ -71,8 +73,8 @@ public class WireMockServerWebhookTests
|
||||
};
|
||||
|
||||
// Assert
|
||||
var response = await new HttpClient().SendAsync(request);
|
||||
var content = await response.Content.ReadAsStringAsync();
|
||||
var response = await new HttpClient().SendAsync(request, _ct);
|
||||
var content = await response.Content.ReadAsStringAsync(_ct);
|
||||
|
||||
response.StatusCode.Should().Be(HttpStatusCode.OK);
|
||||
content.Should().Be("a-response");
|
||||
@@ -120,8 +122,8 @@ public class WireMockServerWebhookTests
|
||||
};
|
||||
|
||||
// Assert
|
||||
var response = await new HttpClient().SendAsync(request);
|
||||
var content = await response.Content.ReadAsStringAsync();
|
||||
var response = await new HttpClient().SendAsync(request, _ct);
|
||||
var content = await response.Content.ReadAsStringAsync(_ct);
|
||||
|
||||
response.StatusCode.Should().Be(HttpStatusCode.OK);
|
||||
content.Should().Be("a-response");
|
||||
@@ -176,8 +178,8 @@ public class WireMockServerWebhookTests
|
||||
};
|
||||
|
||||
// Assert
|
||||
var response = await new HttpClient().SendAsync(request);
|
||||
var content = await response.Content.ReadAsStringAsync();
|
||||
var response = await new HttpClient().SendAsync(request, _ct);
|
||||
var content = await response.Content.ReadAsStringAsync(_ct);
|
||||
|
||||
response.StatusCode.Should().Be(HttpStatusCode.OK);
|
||||
content.Should().Be("a-response");
|
||||
@@ -231,8 +233,8 @@ public class WireMockServerWebhookTests
|
||||
};
|
||||
|
||||
// Assert
|
||||
var response = await new HttpClient().SendAsync(request);
|
||||
var content = await response.Content.ReadAsStringAsync();
|
||||
var response = await new HttpClient().SendAsync(request, _ct);
|
||||
var content = await response.Content.ReadAsStringAsync(_ct);
|
||||
|
||||
response.StatusCode.Should().Be(HttpStatusCode.OK);
|
||||
content.Should().Be("a-response");
|
||||
@@ -263,14 +265,14 @@ public class WireMockServerWebhookTests
|
||||
};
|
||||
|
||||
// Assert
|
||||
var response = await new HttpClient().SendAsync(request);
|
||||
var content = await response.Content.ReadAsStringAsync();
|
||||
var response = await new HttpClient().SendAsync(request, _ct);
|
||||
var content = await response.Content.ReadAsStringAsync(_ct);
|
||||
|
||||
response.StatusCode.Should().Be(HttpStatusCode.OK);
|
||||
content.Should().Be("a-response");
|
||||
|
||||
serverReceivingTheWebhook.LogEntries.Should().HaveCount(1);
|
||||
serverReceivingTheWebhook.LogEntries.First().RequestMessage.Body.Should().Be("OK !");
|
||||
serverReceivingTheWebhook.LogEntries.First().RequestMessage!.Body.Should().Be("OK !");
|
||||
|
||||
server.Dispose();
|
||||
serverReceivingTheWebhook.Dispose();
|
||||
@@ -297,14 +299,14 @@ public class WireMockServerWebhookTests
|
||||
};
|
||||
|
||||
// Assert
|
||||
var response = await new HttpClient().SendAsync(request);
|
||||
var content = await response.Content.ReadAsStringAsync();
|
||||
var response = await new HttpClient().SendAsync(request, _ct);
|
||||
var content = await response.Content.ReadAsStringAsync(_ct);
|
||||
|
||||
response.StatusCode.Should().Be(HttpStatusCode.OK);
|
||||
content.Should().Be("a-response");
|
||||
|
||||
serverReceivingTheWebhook.LogEntries.Should().HaveCount(1);
|
||||
serverReceivingTheWebhook.LogEntries.First().RequestMessage.Body.Should().Be("{\"Status\":\"OK\"}");
|
||||
serverReceivingTheWebhook.LogEntries.First().RequestMessage!.Body.Should().Be("{\"Status\":\"OK\"}");
|
||||
|
||||
server.Dispose();
|
||||
serverReceivingTheWebhook.Dispose();
|
||||
|
||||
Reference in New Issue
Block a user