mirror of
https://github.com/wiremock/WireMock.Net.git
synced 2026-11-27 18:52:48 +01:00
New SonarCloud project (#1534)
* SonarCloud test * xxx * WebSocketIntegrationTests * move sonar to github * SonarCloud now runs for every Linux workflow event. The begin step supplies pull-request key/branch/base metadata for PRs and branch metadata for pushes; the end step is no longer gated. Workflow YAML parsing and the solution build both pass. * SHA
This commit is contained in:
1 parent
6ae65ba73e
commit
dbf90c6888
7 files changed
+97
-42
No files matched your search
@@ -16,7 +16,7 @@ public class WebSocketIntegrationTests(ITestOutputHelper output, ITestContextAcc
|
||||
private readonly CancellationToken _ct = testContext.Current.CancellationToken;
|
||||
|
||||
[Fact]
|
||||
public async Task WithNoSetupShouldJustWaitForClose_AndCLose_When_ClientCloses()
|
||||
public async Task WithNoSetupShouldJustWaitForClose_AndClose_When_ClientCloses()
|
||||
{
|
||||
// Arrange
|
||||
using var server = WireMockServer.Start(new WireMockServerSettings
|
||||
@@ -706,12 +706,14 @@ public class WebSocketIntegrationTests(ITestOutputHelper output, ITestContextAcc
|
||||
public async Task WithWebSocketProxy_Should_Proxy_Multiple_TextMessages()
|
||||
{
|
||||
// Arrange - Start target echo server
|
||||
var exampleEchoServer = WireMockServer.Start(new WireMockServerSettings
|
||||
using var exampleEchoServer = WireMockServer.Start(new WireMockServerSettings
|
||||
{
|
||||
Logger = new TestOutputHelperWireMockLogger(output),
|
||||
Urls = ["ws://localhost:0"]
|
||||
});
|
||||
|
||||
await Task.Delay(500, _ct);
|
||||
|
||||
exampleEchoServer
|
||||
.Given(Request.Create()
|
||||
.WithPath("/ws/target")
|
||||
@@ -724,12 +726,14 @@ public class WebSocketIntegrationTests(ITestOutputHelper output, ITestContextAcc
|
||||
await Task.Delay(500, _ct);
|
||||
|
||||
// Arrange - Start proxy server
|
||||
var sut = WireMockServer.Start(new WireMockServerSettings
|
||||
using var sut = WireMockServer.Start(new WireMockServerSettings
|
||||
{
|
||||
Logger = new TestOutputHelperWireMockLogger(output),
|
||||
Urls = ["ws://localhost:0"]
|
||||
});
|
||||
|
||||
await Task.Delay(500, _ct);
|
||||
|
||||
sut
|
||||
.Given(Request.Create()
|
||||
.WithPath("/ws/proxy")
|
||||
@@ -761,26 +765,20 @@ public class WebSocketIntegrationTests(ITestOutputHelper output, ITestContextAcc
|
||||
}
|
||||
|
||||
await client.CloseAsync(WebSocketCloseStatus.NormalClosure, "Test complete", _ct);
|
||||
|
||||
await Task.Delay(250, _ct);
|
||||
|
||||
sut.Stop();
|
||||
sut.Dispose();
|
||||
|
||||
exampleEchoServer.Stop();
|
||||
exampleEchoServer.Dispose();
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task WithWebSocketProxy_Should_Proxy_Binary_Messages()
|
||||
{
|
||||
// Arrange - Start target echo server
|
||||
var exampleEchoServer = WireMockServer.Start(new WireMockServerSettings
|
||||
using var exampleEchoServer = WireMockServer.Start(new WireMockServerSettings
|
||||
{
|
||||
Logger = new TestOutputHelperWireMockLogger(output),
|
||||
Urls = ["ws://localhost:0"]
|
||||
});
|
||||
|
||||
await Task.Delay(500, _ct);
|
||||
|
||||
exampleEchoServer
|
||||
.Given(Request.Create()
|
||||
.WithPath("/ws/target")
|
||||
@@ -793,12 +791,14 @@ public class WebSocketIntegrationTests(ITestOutputHelper output, ITestContextAcc
|
||||
await Task.Delay(500, _ct);
|
||||
|
||||
// Arrange - Start proxy server
|
||||
var sut = WireMockServer.Start(new WireMockServerSettings
|
||||
using var sut = WireMockServer.Start(new WireMockServerSettings
|
||||
{
|
||||
Logger = new TestOutputHelperWireMockLogger(output),
|
||||
Urls = ["ws://localhost:0"]
|
||||
});
|
||||
|
||||
await Task.Delay(500, _ct);
|
||||
|
||||
sut
|
||||
.Given(Request.Create()
|
||||
.WithPath("/ws/proxy")
|
||||
@@ -828,15 +828,9 @@ public class WebSocketIntegrationTests(ITestOutputHelper output, ITestContextAcc
|
||||
// Assert
|
||||
receivedData.Should().BeEquivalentTo(testData, "binary data should be proxied and echoed back");
|
||||
|
||||
await Task.Delay(500, _ct);
|
||||
|
||||
await client.CloseAsync(WebSocketCloseStatus.NormalClosure, "Test complete", _ct);
|
||||
|
||||
await Task.Delay(250, _ct);
|
||||
|
||||
sut.Stop();
|
||||
sut.Dispose();
|
||||
|
||||
exampleEchoServer.Stop();
|
||||
exampleEchoServer.Dispose();
|
||||
}
|
||||
|
||||
[Fact]
|
||||
|
||||
Reference in new issue
Block a user