diff --git a/src/libraries/System.Net.Sockets/tests/FunctionalTests/SendFile.cs b/src/libraries/System.Net.Sockets/tests/FunctionalTests/SendFile.cs index a4a8ae0da7ecf..c41b1d60c0c65 100644 --- a/src/libraries/System.Net.Sockets/tests/FunctionalTests/SendFile.cs +++ b/src/libraries/System.Net.Sockets/tests/FunctionalTests/SendFile.cs @@ -62,9 +62,11 @@ public async Task NotConnected_ThrowsException() } - [Fact] + [Theory] + [InlineData(false)] + [InlineData(true)] [PlatformSpecific(TestPlatforms.Windows)] - public async Task UdpConnection_ThrowsException() + public async Task UdpConnection_ThrowsException(bool usePreAndPostbufferOverload) { // Create file to send byte[] preBuffer; @@ -78,8 +80,14 @@ public async Task UdpConnection_ThrowsException() client.Connect(listener.LocalEndPoint); - await Assert.ThrowsAsync(() => SendFileAsync(client, tempFile.Path)); - await Assert.ThrowsAsync(() => SendFileAsync(client, tempFile.Path, Array.Empty(), Array.Empty(), TransmitFileOptions.UseDefaultWorkerThread)); + if (usePreAndPostbufferOverload) + { + await Assert.ThrowsAsync(() => SendFileAsync(client, tempFile.Path, Array.Empty(), Array.Empty(), TransmitFileOptions.UseDefaultWorkerThread)); + } + else + { + await Assert.ThrowsAsync(() => SendFileAsync(client, tempFile.Path)); + } } [Theory]