Skip to content

Commit 29d1783

Browse files
authored
Test | Convert SqlVariantParameterTests to xunit assertions (dotnet#4034)
* Move test logic from SqlVariantParam to SqlVariantParameterTests * Convert SqlVariantParameterTests to xunit assertions * Remove baseline files and parsing logic * Fix SqlString TVP collation issue on Linux The default SqlString constructor uses CultureInfo.CurrentCulture.LCID, which on Linux returns 127 (InvariantCulture). LCID 127 is not a valid SQL Server collation. The TVP code path (ValueUtilsSmi.SetSqlString_Unchecked) encodes the SqlString's LCID directly into the TDS stream, unlike the regular parameter path which uses the server's default collation. Use explicit LCID 1033 (en-US) with matching compare options to ensure a valid SQL Server collation is always used in the test. * Remove globalization using. * Work around SqlString LCID product bug in TVP test ValueUtilsSmi.GetSqlValue reconstructs SqlString values from Variant columns using new SqlString(string), which uses CultureInfo.CurrentCulture.LCID. On Linux, this is 127 (InvariantCulture) - not a valid SQL Server collation. The original test worked around this by setting Thread.CurrentThread.CurrentCulture to en-US before running. Restore that pattern with a clear comment explaining why it's needed. Revert SqlString test data back to the simple constructor since setting an explicit LCID on it has no effect - the LCID is lost when the value is read back from SqlDataRecord during TVP serialization. * Fix collation. Split tests down even further to aid debugging. * Address copilot comments. * Clarify special bulk copy behavior * Improve readability. * Remove baseline file missed in conflicts with main. * Disable discovery enumeration of tests.
1 parent 8c661c9 commit 29d1783

4 files changed

Lines changed: 298 additions & 425 deletions

File tree

src/Microsoft.Data.SqlClient/tests/ManualTests/Microsoft.Data.SqlClient.ManualTests.csproj

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -213,7 +213,6 @@
213213
<Compile Include="SQL\ParameterTest\DateTimeVariantTest.cs" />
214214
<Compile Include="SQL\ParameterTest\ParametersTest.cs" />
215215
<Compile Include="SQL\ParameterTest\SqlAdapterUpdateBatch.cs" />
216-
<Compile Include="SQL\ParameterTest\SqlVariantParam.cs" />
217216
<Compile Include="SQL\ParameterTest\SteAttribute.cs" />
218217
<Compile Include="SQL\ParameterTest\SteParam.cs" />
219218
<Compile Include="SQL\ParameterTest\StePermutationSet.cs" />
@@ -269,10 +268,6 @@
269268
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
270269
<Link>DateTimeVariant.bsl</Link>
271270
</Content>
272-
<Content Include="SQL\ParameterTest\SqlVariantParameter.bsl">
273-
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
274-
<Link>SqlVariantParameter.bsl</Link>
275-
</Content>
276271
<Content Include="SQL\ParameterTest\StreamInputParameter_DebugMode.bsl">
277272
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
278273
<Link>StreamInputParameter_DebugMode.bsl</Link>

src/Microsoft.Data.SqlClient/tests/ManualTests/SQL/ParameterTest/SqlVariantParam.cs

Lines changed: 0 additions & 256 deletions
This file was deleted.

0 commit comments

Comments
 (0)