one last try to get this test de-flaked (#227)
This commit is contained in:
parent
755ba7613e
commit
f84362cc76
|
|
@ -198,7 +198,8 @@ namespace Microsoft.Extensions.WebSockets.Internal
|
|||
{
|
||||
if (State == WebSocketConnectionState.Closed)
|
||||
{
|
||||
throw new ObjectDisposedException(nameof(WebSocketConnection));
|
||||
// Already closed
|
||||
return;
|
||||
}
|
||||
else if (State == WebSocketConnectionState.Created)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -123,7 +123,6 @@ namespace Microsoft.Extensions.WebSockets.Internal.Tests
|
|||
// Verify we can't restart the connection or send a message
|
||||
await Assert.ThrowsAsync<ObjectDisposedException>(async () => await pair.ServerSocket.ExecuteAsync(f => { }));
|
||||
await Assert.ThrowsAsync<ObjectDisposedException>(async () => await pair.ClientSocket.SendAsync(CreateTextFrame("Nope")));
|
||||
await Assert.ThrowsAsync<ObjectDisposedException>(async () => await pair.ClientSocket.CloseAsync(new WebSocketCloseResult(WebSocketCloseStatus.NormalClosure)));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -22,7 +22,7 @@ namespace Microsoft.Extensions.WebSockets.Internal.Tests
|
|||
var startTime = DateTime.UtcNow;
|
||||
// Arrange
|
||||
using (var pair = WebSocketPair.Create(
|
||||
serverOptions: new WebSocketOptions().WithAllFramesPassedThrough().WithPingInterval(TimeSpan.FromMilliseconds(100)),
|
||||
serverOptions: new WebSocketOptions().WithAllFramesPassedThrough().WithPingInterval(TimeSpan.FromMilliseconds(10)),
|
||||
clientOptions: new WebSocketOptions().WithAllFramesPassedThrough()))
|
||||
{
|
||||
var client = pair.ClientSocket.ExecuteAndCaptureFramesAsync();
|
||||
|
|
@ -47,8 +47,7 @@ namespace Microsoft.Extensions.WebSockets.Internal.Tests
|
|||
var str = Encoding.UTF8.GetString(f.Payload.ToArray());
|
||||
|
||||
// We can't verify the exact timestamp, but we can verify that it is a timestamp created after we started.
|
||||
DateTime dt;
|
||||
if (DateTime.TryParseExact(str, "O", CultureInfo.InvariantCulture, DateTimeStyles.AdjustToUniversal, out dt))
|
||||
if (DateTime.TryParseExact(str, "O", CultureInfo.InvariantCulture, DateTimeStyles.AdjustToUniversal, out var dt))
|
||||
{
|
||||
return dt >= startTime;
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue