Skip to content

Tests | Remove DataAttribute Subclasses#4427

Open
benrr101 wants to merge 4 commits into
mainfrom
dev/russellben/xunit3-prereqs
Open

Tests | Remove DataAttribute Subclasses#4427
benrr101 wants to merge 4 commits into
mainfrom
dev/russellben/xunit3-prereqs

Conversation

@benrr101

@benrr101 benrr101 commented Jul 6, 2026

Copy link
Copy Markdown
Contributor

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 used MemberData attribute 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.

@benrr101 benrr101 added this to the 7.1.0-preview3 milestone Jul 6, 2026
Copilot AI review requested due to automatic review settings July 6, 2026 17:28
@benrr101 benrr101 requested a review from a team as a code owner July 6, 2026 17:28
@benrr101 benrr101 added the Area\Tests Issues that are targeted to tests or test projects label Jul 6, 2026
@github-project-automation github-project-automation Bot moved this to To triage in SqlClient Board Jul 6, 2026

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 DataAttribute classes.

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.

@benrr101 benrr101 enabled auto-merge (squash) July 7, 2026 18:48
@cheenamalhotra cheenamalhotra moved this from To triage to In review in SqlClient Board Jul 7, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Area\Tests Issues that are targeted to tests or test projects

Projects

Status: In review

Development

Successfully merging this pull request may close these issues.

4 participants