mirror of
https://github.com/wiremock/WireMock.Net.git
synced 2026-03-23 17:41:01 +01:00
.
This commit is contained in:
@@ -808,8 +808,6 @@ public class WebSocketIntegrationTests(ITestOutputHelper output, ITestContextAcc
|
||||
receivedData.Should().BeEquivalentTo(testData, "binary data should be proxied and echoed back");
|
||||
|
||||
await client.CloseAsync(WebSocketCloseStatus.NormalClosure, "Test complete", _ct);
|
||||
|
||||
await Task.Delay(100, _ct);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
@@ -863,6 +861,8 @@ public class WebSocketIntegrationTests(ITestOutputHelper output, ITestContextAcc
|
||||
await client2.ConnectAsync(uri, _ct);
|
||||
await client3.ConnectAsync(uri, _ct);
|
||||
|
||||
await Task.Delay(500, _ct);
|
||||
|
||||
await client1.SendAsync("register", cancellationToken: _ct);
|
||||
await client2.SendAsync("register", cancellationToken: _ct);
|
||||
await client3.SendAsync("register", cancellationToken: _ct);
|
||||
@@ -891,8 +891,6 @@ public class WebSocketIntegrationTests(ITestOutputHelper output, ITestContextAcc
|
||||
await client1.CloseAsync(WebSocketCloseStatus.NormalClosure, "Test complete", _ct);
|
||||
await client2.CloseAsync(WebSocketCloseStatus.NormalClosure, "Test complete", _ct);
|
||||
await client3.CloseAsync(WebSocketCloseStatus.NormalClosure, "Test complete", _ct);
|
||||
|
||||
await Task.Delay(300, _ct);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
@@ -941,6 +939,8 @@ public class WebSocketIntegrationTests(ITestOutputHelper output, ITestContextAcc
|
||||
await client2.ConnectAsync(uri, _ct);
|
||||
await client3.ConnectAsync(uri, _ct);
|
||||
|
||||
await Task.Delay(500, _ct);
|
||||
|
||||
await client1.SendAsync("register", cancellationToken: _ct);
|
||||
await client2.SendAsync("register", cancellationToken: _ct);
|
||||
await client3.SendAsync("register", cancellationToken: _ct);
|
||||
@@ -969,8 +969,6 @@ public class WebSocketIntegrationTests(ITestOutputHelper output, ITestContextAcc
|
||||
await client1.CloseAsync(WebSocketCloseStatus.NormalClosure, "Test complete", _ct);
|
||||
await client2.CloseAsync(WebSocketCloseStatus.NormalClosure, "Test complete", _ct);
|
||||
await client3.CloseAsync(WebSocketCloseStatus.NormalClosure, "Test complete", _ct);
|
||||
|
||||
await Task.Delay(300, _ct);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
@@ -1026,8 +1024,6 @@ public class WebSocketIntegrationTests(ITestOutputHelper output, ITestContextAcc
|
||||
|
||||
await client1.CloseAsync(WebSocketCloseStatus.NormalClosure, "Test complete", _ct);
|
||||
await client2.CloseAsync(WebSocketCloseStatus.NormalClosure, "Test complete", _ct);
|
||||
|
||||
await Task.Delay(300, _ct);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
@@ -1090,8 +1086,6 @@ public class WebSocketIntegrationTests(ITestOutputHelper output, ITestContextAcc
|
||||
|
||||
await client1.CloseAsync(WebSocketCloseStatus.NormalClosure, "Test complete", _ct);
|
||||
await client2.CloseAsync(WebSocketCloseStatus.NormalClosure, "Test complete", _ct);
|
||||
|
||||
await Task.Delay(200, _ct);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
@@ -1137,8 +1131,6 @@ public class WebSocketIntegrationTests(ITestOutputHelper output, ITestContextAcc
|
||||
received.Should().Be(broadcastMessage);
|
||||
|
||||
await client.CloseAsync(WebSocketCloseStatus.NormalClosure, "Test complete", _ct);
|
||||
|
||||
await Task.Delay(100, _ct);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
@@ -1183,6 +1175,8 @@ public class WebSocketIntegrationTests(ITestOutputHelper output, ITestContextAcc
|
||||
// Act - disconnect client1
|
||||
await client1.CloseAsync(WebSocketCloseStatus.NormalClosure, "Disconnecting", _ct);
|
||||
|
||||
await Task.Delay(500, _ct);
|
||||
|
||||
// Send broadcast from client2 - should handle disconnected client gracefully
|
||||
await client2.SendAsync(broadcastMessage, cancellationToken: _ct);
|
||||
|
||||
@@ -1191,8 +1185,6 @@ public class WebSocketIntegrationTests(ITestOutputHelper output, ITestContextAcc
|
||||
received2.Should().Be(broadcastMessage);
|
||||
|
||||
await client2.CloseAsync(WebSocketCloseStatus.NormalClosure, "Test complete", _ct);
|
||||
|
||||
await Task.Delay(200, _ct);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
@@ -1254,7 +1246,5 @@ public class WebSocketIntegrationTests(ITestOutputHelper output, ITestContextAcc
|
||||
|
||||
await client1.CloseAsync(WebSocketCloseStatus.NormalClosure, "Test complete", _ct);
|
||||
await client2.CloseAsync(WebSocketCloseStatus.NormalClosure, "Test complete", _ct);
|
||||
|
||||
await Task.Delay(200, _ct);
|
||||
}
|
||||
}
|
||||
@@ -48,6 +48,8 @@ public class WireMockServerWebSocketIntegrationTests(ITestOutputHelper output, I
|
||||
await client2.ConnectAsync(uri, _ct);
|
||||
await client3.ConnectAsync(uri, _ct);
|
||||
|
||||
await Task.Delay(500, _ct);
|
||||
|
||||
// Assert
|
||||
var connections = server.GetWebSocketConnections();
|
||||
connections.Should().HaveCount(3);
|
||||
@@ -56,8 +58,6 @@ public class WireMockServerWebSocketIntegrationTests(ITestOutputHelper output, I
|
||||
await client1.CloseAsync(WebSocketCloseStatus.NormalClosure, "Test complete", _ct);
|
||||
await client2.CloseAsync(WebSocketCloseStatus.NormalClosure, "Test complete", _ct);
|
||||
await client3.CloseAsync(WebSocketCloseStatus.NormalClosure, "Test complete", _ct);
|
||||
|
||||
await Task.Delay(300, _ct);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
@@ -140,6 +140,8 @@ public class WireMockServerWebSocketIntegrationTests(ITestOutputHelper output, I
|
||||
await client2.ConnectAsync(uri1, _ct);
|
||||
await client3.ConnectAsync(uri2, _ct);
|
||||
|
||||
await Task.Delay(500, _ct);
|
||||
|
||||
// Assert
|
||||
var allConnections = server.GetWebSocketConnections();
|
||||
allConnections.Should().HaveCount(3);
|
||||
@@ -153,8 +155,6 @@ public class WireMockServerWebSocketIntegrationTests(ITestOutputHelper output, I
|
||||
await client1.CloseAsync(WebSocketCloseStatus.NormalClosure, "Test complete", _ct);
|
||||
await client2.CloseAsync(WebSocketCloseStatus.NormalClosure, "Test complete", _ct);
|
||||
await client3.CloseAsync(WebSocketCloseStatus.NormalClosure, "Test complete", _ct);
|
||||
|
||||
await Task.Delay(300, _ct);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
@@ -187,6 +187,8 @@ public class WireMockServerWebSocketIntegrationTests(ITestOutputHelper output, I
|
||||
await client1.ConnectAsync(uri, _ct);
|
||||
await client2.ConnectAsync(uri, _ct);
|
||||
|
||||
await Task.Delay(500, _ct);
|
||||
|
||||
var connections = server.GetWebSocketConnections();
|
||||
connections.Should().HaveCount(2);
|
||||
|
||||
@@ -200,8 +202,6 @@ public class WireMockServerWebSocketIntegrationTests(ITestOutputHelper output, I
|
||||
remainingConnections.Should().HaveCount(1);
|
||||
var remainingConnection = remainingConnections.First();
|
||||
remainingConnection.ConnectionId.Should().NotBe(connectionIdToAbort);
|
||||
|
||||
await Task.Delay(200, _ct);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
@@ -270,8 +270,6 @@ public class WireMockServerWebSocketIntegrationTests(ITestOutputHelper output, I
|
||||
|
||||
await client1.CloseAsync(WebSocketCloseStatus.NormalClosure, "Test complete", _ct);
|
||||
await client2.CloseAsync(WebSocketCloseStatus.NormalClosure, "Test complete", _ct);
|
||||
|
||||
await Task.Delay(200, _ct);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
@@ -340,8 +338,6 @@ public class WireMockServerWebSocketIntegrationTests(ITestOutputHelper output, I
|
||||
|
||||
await client1.CloseAsync(WebSocketCloseStatus.NormalClosure, "Test complete", _ct);
|
||||
await client2.CloseAsync(WebSocketCloseStatus.NormalClosure, "Test complete", _ct);
|
||||
|
||||
await Task.Delay(200, _ct);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
@@ -430,8 +426,6 @@ public class WireMockServerWebSocketIntegrationTests(ITestOutputHelper output, I
|
||||
|
||||
await client1.CloseAsync(WebSocketCloseStatus.NormalClosure, "Test complete", _ct);
|
||||
await client2.CloseAsync(WebSocketCloseStatus.NormalClosure, "Test complete", _ct);
|
||||
|
||||
await Task.Delay(200, _ct);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
@@ -520,8 +514,6 @@ public class WireMockServerWebSocketIntegrationTests(ITestOutputHelper output, I
|
||||
|
||||
await client1.CloseAsync(WebSocketCloseStatus.NormalClosure, "Test complete", _ct);
|
||||
await client2.CloseAsync(WebSocketCloseStatus.NormalClosure, "Test complete", _ct);
|
||||
|
||||
await Task.Delay(200, _ct);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
@@ -552,23 +544,22 @@ public class WireMockServerWebSocketIntegrationTests(ITestOutputHelper output, I
|
||||
var uri = new Uri($"{server.Url}/ws/test");
|
||||
|
||||
await client1.ConnectAsync(uri, _ct);
|
||||
await Task.Delay(100, _ct);
|
||||
await client2.ConnectAsync(uri, _ct);
|
||||
await Task.Delay(100, _ct);
|
||||
|
||||
await Task.Delay(500, _ct);
|
||||
|
||||
var initialConnections = server.GetWebSocketConnections();
|
||||
initialConnections.Should().HaveCount(2);
|
||||
|
||||
// Act
|
||||
await client1.CloseAsync(WebSocketCloseStatus.NormalClosure, "Disconnect", _ct);
|
||||
await Task.Delay(100, _ct);
|
||||
|
||||
await Task.Delay(500, _ct);
|
||||
|
||||
// Assert
|
||||
var remainingConnections = server.GetWebSocketConnections();
|
||||
remainingConnections.Should().HaveCount(1);
|
||||
|
||||
await client2.CloseAsync(WebSocketCloseStatus.NormalClosure, "Test complete", _ct);
|
||||
|
||||
await Task.Delay(200, _ct);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user