Tests | Remove DataAttribute Subclasses#4427
Open
benrr101 wants to merge 4 commits into
Open
Conversation
…oreProviderShould.cs and SqlColumnEncryptionCngProviderShould.cs
Contributor
There was a problem hiding this comment.
Pull request overview
This PR refactors a few Always Encrypted functional tests to stop using nested DataAttribute subclasses for theory data (unsupported by xUnit 3), replacing them with MemberData backed by static TheoryData properties. This is aligned with the repo’s longer-term effort to make an eventual xUnit 3 migration easier once net462 test support is removed.
Changes:
- Replaced custom
[DataAttribute]-based theory data with[MemberData]across CSP/CNG/CertificateStore provider test suites. - Introduced static
TheoryData<...>properties colocated with the theories that consume them. - Removed the old nested
DataAttributeclasses.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
| src/Microsoft.Data.SqlClient/tests/FunctionalTests/AlwaysEncryptedTests/SqlColumnEncryptionCspProviderShould.cs | Switches invalid-parameter theory data to MemberData with static TheoryData. |
| src/Microsoft.Data.SqlClient/tests/FunctionalTests/AlwaysEncryptedTests/SqlColumnEncryptionCngProviderShould.cs | Switches invalid-parameter theory data to MemberData with static TheoryData. |
| src/Microsoft.Data.SqlClient/tests/FunctionalTests/AlwaysEncryptedTests/SqlColumnEncryptionCertificateStoreProviderShould.cs | Switches multiple theory data sources (decrypt/encrypt/sign/AED reversal) to MemberData with static TheoryData. |
cheenamalhotra
approved these changes
Jul 7, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Eventually, we'd like to upgrade to xUnit 3. The biggest showstopper for this is that xUnit 3 does not support net462. But, there are smaller tasks we could address to make upgrading easier once we no longer support net462 (or at least don't support in in our tests). This PR is one of those small upgrade tasks. A small collection of tests were using implementing theory data via nested classes that inherited from
DataAttribute. This is not supported in xUnit 3. To resolve this, I've switched these instances to the commonly usedMemberDataattribute usage, and made the nested classes into static properties next to the tests that use them.Yes, the lines are very long. I didn't attempt to clean them up because I personally feel the longer lines are more readable than trying to chop the lines.
Testing
These are non-functional changes to tests, so PR validation should be sufficient.