Skip to content

Clarify ClassDataSource constructor requirements - #6716

Merged
thomhurst merged 2 commits into
mainfrom
docs/class-data-source-constructor-requirements
Sep 3, 2026
Merged

thomhurst merged 2 commits into
mainfrom
docs/class-data-source-constructor-requirements

Conversation

@thomhurst

@thomhurst thomhurst commented Sep 3, 2026 •

Copy link
Copy Markdown
Owner

Summary

  • Document the accessible parameterless constructor requirement for ClassDataSource<T> types.
  • Distinguish supported test-class constructor injection from unsupported constructor injection inside data source types.
  • Add a nested property-injection example and cross-reference the detailed guide.

Validation

  • yarn build from docs

Refs #6694

Summary by CodeRabbit

  • Documentation
    • Clarified that ClassDataSource<T> types require a public parameterless constructor.
    • Recommended property injection for nested dependencies within data sources.
    • Added guidance and an example for asynchronously initializing dependent fixtures.
    • Documented that constructor-injected dependencies inside data source types are not currently supported.
    • Updated shared-fixture guidance to clarify test-class constructor parameter usage.

@chatgpt-codex-connector

ghost commented Sep 3, 2026

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.

@greptile-apps

ghost commented Sep 3, 2026 •

Copy link
Copy Markdown
Contributor

Greptile Summary

The PR clarifies the construction rules for ClassDataSource<T> and distinguishes test-class constructor injection from nested data-source dependency injection.

  • States consistently that data-source types require a public parameterless constructor.
  • Recommends property injection for nested dependencies.
  • Adds an initialization-order example and links to the detailed nested-property-injection guide.

Confidence Score: 5/5

The documentation-only PR appears safe to merge.

No blocking failure remains.

Important Files Changed

Filename Overview
README.md Clarifies that constructor parameters are supported on test classes while data-source types require public parameterless constructors.
docs/docs/writing-tests/class-data-source.md Documents the public-constructor requirement and adds a nested property-injection example with lifecycle guidance.
docs/docs/writing-tests/nested-data-sources.md Explicitly directs nested data-source dependencies to property injection and accurately states the public-constructor requirement.

Reviews (2): Last reviewed commit: "docs: require public ClassDataSource con..." | Re-trigger Greptile

Comment thread docs/docs/writing-tests/class-data-source.md Outdated
@coderabbitai

ghost commented Sep 3, 2026 •

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Team

Run ID: 01526aa2-a1be-41e1-8633-e342a6a85327

📥 Commits

Reviewing files that changed from the base of the PR and between 8685475 and 2d22632.

📒 Files selected for processing (3)
  • README.md
  • docs/docs/writing-tests/class-data-source.md
  • docs/docs/writing-tests/nested-data-sources.md
🚧 Files skipped from review as they are similar to previous changes (3)
  • README.md
  • docs/docs/writing-tests/nested-data-sources.md
  • docs/docs/writing-tests/class-data-source.md

Included review availability: Your plan provides up to 8 included reviews per hour; 2 remain after this review.


📝 Walkthrough

Walkthrough

The documentation states that ClassDataSource<T> requires a public parameterless constructor. It recommends property injection for nested dependencies and documents constructor injection on the receiving test class.

Changes

ClassDataSource documentation

Layer / File(s) Summary
Constructor and nested dependency guidance
docs/docs/writing-tests/class-data-source.md, docs/docs/writing-tests/nested-data-sources.md, README.md
The documentation explains ClassDataSource<T> constructor requirements, distinguishes test-class constructor injection from data-source construction, and provides an IAsyncInitializer example using property injection for nested dependencies.

Estimated code review effort: 1 (Trivial) | ~3 minutes

Merge Risk: ⚪ Minimal · up to 2d226

This documentation update clarifies supported dependency injection patterns for ClassDataSource types, with no identified merge-readiness risk.

Poem

A rabbit reads the fixture guide,
With nested properties safe inside.
A public constructor marks the way,
While async fixtures start the day.
Clear documentation leads the way.

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and concisely describes the main change: documenting the constructor requirements for ClassDataSource types.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check. Docstring coverage is scoped to functions touched by this diff. Analyzed 0 functions across 0…
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Full details: Docstring Coverage

Explanation

No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check. Docstring coverage is scoped to functions touched by this diff. Analyzed 0 functions across 0 files. (3 skipped: 3 unsupported.)

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch docs/class-data-source-constructor-requirements

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@claude

ghost commented Sep 3, 2026

Copy link
Copy Markdown
Contributor

Code review

Reviewed the diff (README.md, docs/docs/writing-tests/class-data-source.md, docs/docs/writing-tests/nested-data-sources.md) — this is a documentation-only change with no source-gen or reflection-engine code touched, so the dual-mode requirement in CLAUDE.md doesn't apply here.

Technical accuracy check: I verified the core claim against the implementation rather than taking it on faith. ClassDataSources.Create (src/TUnit.Core/Attributes/TestData/ClassDataSources.cs:92) instantiates data-source types via Activator.CreateInstance(type) with no constructor arguments — which does require a public parameterless constructor. The new docs and example (nested ApplicationFixture/DatabaseFixture using property injection + IAsyncInitializer) accurately reflect this behavior and the initialization order described in nested-data-sources.md.

No issues found. The added example is clear, the distinction between test-class constructor injection (supported) and data-source constructor injection (unsupported) is well explained, and no CLAUDE.md rules are implicated by a docs-only change. Nothing to flag architecturally — this is straightforward prose/example documentation, not a case where alternative designs apply.

🤖 Generated with automated code review

This was referenced Sep 23, 2026

This branch was previously deployed

1 inactive deployment
Pull Requests — 2d22632c Deployed Sep 3, 2026 by thomhurst via modularpipeline (ubuntu-latest) #19004
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant