Refactor TestDataConnectionSql into focused partial modules#8270
Conversation
Co-authored-by: Evangelink <11340282+Evangelink@users.noreply.github.com>
Co-authored-by: Evangelink <11340282+Evangelink@users.noreply.github.com>
Co-authored-by: Evangelink <11340282+Evangelink@users.noreply.github.com>
TestDataConnectionSql into focused partial modules
|
@copilot fix the following build issues @azure-pipelines src\Adapter\MSTestAdapter.PlatformServices\Data\TestDataConnectionSql.Data.cs(78,17): error CS0103: (NETCORE_ENGINEERING_TELEMETRY=Build) The name 'StringEx' does not exist in the current context @azure-pipelines src\Adapter\MSTestAdapter.PlatformServices\Data\TestDataConnectionSql.Helpers.cs(23,61): error CS0103: (NETCORE_ENGINEERING_TELEMETRY=Build) The name 'StringEx' does not exist in the current context @azure-pipelines src\Adapter\MSTestAdapter.PlatformServices\Data\TestDataConnectionSql.Schema.cs(276,19): error CS0246: (NETCORE_ENGINEERING_TELEMETRY=Build) The type or namespace name 'DbCommand' could not be found (are you missing a using directive or an assembly reference?) @azure-pipelines src\Adapter\MSTestAdapter.PlatformServices\Data\TestDataConnectionSql.cs(7,1): error IDE0005: (NETCORE_ENGINEERING_TELEMETRY=Build) Using directive is unnecessary. (https://learn.microsoft.com/dotnet/fundamentals/code-analysis/style-rules/ide0005) @azure-pipelines src\Adapter\MSTestAdapter.PlatformServices\Data\TestDataConnectionSql.Data.cs(5,1): error IDE0005: (NETCORE_ENGINEERING_TELEMETRY=Build) Using directive is unnecessary. (https://learn.microsoft.com/dotnet/fundamentals/code-analysis/style-rules/ide0005) |
There was a problem hiding this comment.
Pull request overview
This PR refactors TestDataConnectionSql into focused partial-class modules while preserving its NETFRAMEWORK-only data connection behavior.
Changes:
- Keeps construction, factory setup, connection state, and disposal in the core file.
- Moves identifier quoting/name parsing, schema discovery, helper types/constants, and table reads into separate partial files.
- Converts
TestDataConnectionSqlto a partial class to support the split.
Show a summary per file
| File | Description |
|---|---|
src/Adapter/MSTestAdapter.PlatformServices/Data/TestDataConnectionSql.cs |
Retains core lifecycle and changes the class to partial. |
src/Adapter/MSTestAdapter.PlatformServices/Data/TestDataConnectionSql.Quotes.cs |
Adds quote prefix/suffix and identifier quoting helpers. |
src/Adapter/MSTestAdapter.PlatformServices/Data/TestDataConnectionSql.Names.cs |
Adds table/name splitting and quote-joining logic. |
src/Adapter/MSTestAdapter.PlatformServices/Data/TestDataConnectionSql.Schema.cs |
Adds schema, table/view, column, and default schema helpers. |
src/Adapter/MSTestAdapter.PlatformServices/Data/TestDataConnectionSql.Data.cs |
Adds table reading and column projection SQL generation. |
src/Adapter/MSTestAdapter.PlatformServices/Data/TestDataConnectionSql.Helpers.cs |
Adds shared provider helpers, metadata structs, and known provider constants. |
Copilot's findings
- Files reviewed: 6/6 changed files
- Comments generated: 1
Co-authored-by: Evangelink <11340282+Evangelink@users.noreply.github.com>
Addressed in b6ead4e. |
- TestDataConnectionSql.Data.cs: separate alias using from regular using with blank line (SA1516/IDE0055). - TestDataConnectionSql.Helpers.cs: remove unused Microsoft.VisualStudio.TestPlatform.MSTest.TestAdapter using (IDE0005) and separate alias. - TestDataConnectionSql.Names.cs / TestDataConnectionSql.Quotes.cs: remove unused MSTest.TestAdapter using (IDE0005). Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
TestDataConnectionSql.cshad grown into a 900+ line, multi-responsibility file spanning connection lifecycle, quoting, name parsing, schema discovery, and data reads. This change separates those concerns into focused partial-class files while preserving the existing API surface and NETFRAMEWORK-only behavior.Core lifecycle
DisposeinTestDataConnectionSql.cs.Quoting and identifier handling
TestDataConnectionSql.Quotes.cs.TestDataConnectionSql.Names.csto isolate identifier normalization from provider quote discovery.Schema inspection
TestDataConnectionSql.Schema.cs.Data access
ReadTableand column projection SQL generation intoTestDataConnectionSql.Data.cs.Shared helpers and constants
TestDataConnectionSql.Helpers.cs.Example of the new structure: