This repository was archived by the owner on Jan 23, 2023. It is now read-only.
File tree Expand file tree Collapse file tree 2 files changed +36
-0
lines changed
src/System.Data.SqlClient/tests/ManualTests Expand file tree Collapse file tree 2 files changed +36
-0
lines changed Original file line number Diff line number Diff line change 1+ using Xunit ;
2+
3+ namespace System . Data . SqlClient . ManualTesting . Tests
4+ {
5+ public static class Utf8SupportTest
6+ {
7+ [ CheckConnStrSetupFact ]
8+ public static void CheckSupportUtf8ConnectionProperty ( )
9+ {
10+ using ( SqlConnection connection = new SqlConnection ( DataTestUtility . TcpConnStr ) )
11+ using ( SqlCommand command = new SqlCommand ( ) )
12+ {
13+ command . Connection = connection ;
14+ command . CommandText = "SELECT CONNECTIONPROPERTY('SUPPORT_UTF8')" ;
15+ connection . Open ( ) ;
16+
17+ using ( SqlDataReader reader = command . ExecuteReader ( ) )
18+ {
19+ while ( reader . Read ( ) )
20+ {
21+ // CONNECTIONPROPERTY('SUPPORT_UTF8') returns NULL in SQLServer versions that don't support UTF-8.
22+ if ( ! reader . IsDBNull ( 0 ) )
23+ {
24+ Assert . Equal ( 1 , reader . GetInt32 ( 0 ) ) ;
25+ }
26+ else
27+ {
28+ Console . WriteLine ( "CONNECTIONPROPERTY('SUPPORT_UTF8') is not supported on this SQLServer" ) ;
29+ }
30+ }
31+ }
32+ }
33+ }
34+ }
35+ }
Original file line number Diff line number Diff line change 121121 <Compile Include =" SQL\UdtTest\UdtTest.cs" />
122122 <Compile Include =" SQL\UdtTest\UdtTest2.cs" />
123123 <Compile Include =" SQL\UdtTest\UdtTestHelpers.cs" />
124+ <Compile Include =" SQL\Utf8SupportTest\Utf8SupportTest.cs" />
124125 <Compile Include =" SQL\WeakRefTest\WeakRefTest.cs" />
125126 <Compile Include =" SQL\WeakRefTestYukonSpecific\WeakRefTestYukonSpecific.cs" />
126127 <Compile Include =" XUnitAssemblyAttributes.cs" />
You can’t perform that action at this time.
0 commit comments