Skip to content

Commit 3e1a656

Browse files
committed
Named instance not supported with proxy
1 parent db7572a commit 3e1a656

File tree

1 file changed

+39
-1
lines changed

1 file changed

+39
-1
lines changed

src/Microsoft.Data.SqlClient/tests/ManualTests/SQL/DataReaderTest/DataReaderTest.cs

Lines changed: 39 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,11 @@
1010
using System.Text;
1111
using System.Threading;
1212
using Xunit;
13+
using Xunit.Abstractions;
1314

1415
namespace Microsoft.Data.SqlClient.ManualTesting.Tests
1516
{
16-
public static class DataReaderTest
17+
public class DataReaderTest
1718
{
1819
private static readonly object s_rowVersionLock = new();
1920

@@ -25,6 +26,13 @@ private enum Tristate : byte
2526
True = 2
2627
}
2728

29+
private ITestOutputHelper _testOutputHelper;
30+
31+
public DataReaderTest(ITestOutputHelper testOutputHelper)
32+
{
33+
_testOutputHelper = testOutputHelper;
34+
}
35+
2836
[ConditionalFact(typeof(DataTestUtility), nameof(DataTestUtility.AreConnStringsSetup))]
2937
public static void LoadReaderIntoDataTableToTestGetSchemaTable()
3038
{
@@ -331,6 +339,36 @@ public static void CheckLegacyNullRowVersionIsEmptyArray()
331339
}
332340
}
333341

342+
[ConditionalFact(typeof(DataTestUtility), nameof(DataTestUtility.AreConnStringsSetup), nameof(DataTestUtility.IsNotAzureSynapse))]
343+
public void BugTest()
344+
{
345+
int rows = 0;
346+
int infoMessages = 0;
347+
using (var conn = new SqlConnection(DataTestUtility.TCPConnectionString))
348+
{
349+
conn.Open();
350+
351+
conn.InfoMessage += (sender, e) => infoMessages++;
352+
353+
var cmd = conn.CreateCommand();
354+
cmd.CommandText = "PRINT('1'); PRINT('2'); SELECT * FROM Customers";
355+
using (var dr = cmd.ExecuteReader())
356+
{
357+
Assert.True(dr.HasRows);
358+
while (dr.Read())
359+
{
360+
Assert.True(dr.HasRows);
361+
rows++;
362+
}
363+
364+
}
365+
366+
_testOutputHelper.WriteLine($"Rows: {rows}");
367+
Assert.True(rows > 0);
368+
Assert.Equal(2, infoMessages);
369+
}
370+
}
371+
334372
private static Tristate SetLegacyRowVersionNullBehavior(Tristate value)
335373
{
336374
Type switchesType = typeof(SqlCommand).Assembly.GetType("Microsoft.Data.SqlClient.LocalAppContextSwitches");

0 commit comments

Comments
 (0)