Commit 29d1783
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
- SQL/ParameterTest
Lines changed: 0 additions & 5 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
213 | 213 | | |
214 | 214 | | |
215 | 215 | | |
216 | | - | |
217 | 216 | | |
218 | 217 | | |
219 | 218 | | |
| |||
269 | 268 | | |
270 | 269 | | |
271 | 270 | | |
272 | | - | |
273 | | - | |
274 | | - | |
275 | | - | |
276 | 271 | | |
277 | 272 | | |
278 | 273 | | |
| |||
Lines changed: 0 additions & 256 deletions
This file was deleted.
0 commit comments