Skip to content

Commit

Permalink
Add test for multiple calls of QuicConnection.CloseAsync (#68893)
Browse files Browse the repository at this point in the history
* Add test for multiple calls of QuicConnection.CloseAsync

* Add test case for server as well
  • Loading branch information
rzikm authored May 5, 2022
1 parent fd60ce8 commit 3116f28
Showing 1 changed file with 24 additions and 0 deletions.
24 changes: 24 additions & 0 deletions src/libraries/System.Net.Quic/tests/FunctionalTests/MsQuicTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -659,6 +659,30 @@ public async Task CloseAsync_ByServer_AcceptThrows()
}
}

[Theory]
[InlineData(true)]
[InlineData(false)]
public async Task CloseAsync_MultipleCalls_FollowingCallsAreIgnored(bool client)
{

(QuicConnection clientConnection, QuicConnection serverConnection) = await CreateConnectedQuicConnection();

using (clientConnection)
using (serverConnection)
{
if (client)
{
await clientConnection.CloseAsync(0);
await clientConnection.CloseAsync(0);
}
else
{
await serverConnection.CloseAsync(0);
await serverConnection.CloseAsync(0);
}
}
}

internal static ReadOnlySequence<byte> CreateReadOnlySequenceFromBytes(byte[] data)
{
List<byte[]> segments = new List<byte[]>
Expand Down

0 comments on commit 3116f28

Please sign in to comment.