10
10
using System . Text ;
11
11
using System . Threading ;
12
12
using Xunit ;
13
+ using Xunit . Abstractions ;
13
14
14
15
namespace Microsoft . Data . SqlClient . ManualTesting . Tests
15
16
{
16
- public static class DataReaderTest
17
+ public class DataReaderTest
17
18
{
18
19
private static readonly object s_rowVersionLock = new ( ) ;
19
20
@@ -25,6 +26,13 @@ private enum Tristate : byte
25
26
True = 2
26
27
}
27
28
29
+ private ITestOutputHelper _testOutputHelper ;
30
+
31
+ public DataReaderTest ( ITestOutputHelper testOutputHelper )
32
+ {
33
+ _testOutputHelper = testOutputHelper ;
34
+ }
35
+
28
36
[ ConditionalFact ( typeof ( DataTestUtility ) , nameof ( DataTestUtility . AreConnStringsSetup ) ) ]
29
37
public static void LoadReaderIntoDataTableToTestGetSchemaTable ( )
30
38
{
@@ -331,6 +339,36 @@ public static void CheckLegacyNullRowVersionIsEmptyArray()
331
339
}
332
340
}
333
341
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
+
334
372
private static Tristate SetLegacyRowVersionNullBehavior ( Tristate value )
335
373
{
336
374
Type switchesType = typeof ( SqlCommand ) . Assembly . GetType ( "Microsoft.Data.SqlClient.LocalAppContextSwitches" ) ;
0 commit comments