-
-
Notifications
You must be signed in to change notification settings - Fork 111
Fix TUnit0001 not reporting for TypedDataSourceAttribute and other IDataSourceAttribute implementations #4741
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
…ismatches - Fix dispatch in Analyze() to route ITypedDataSourceAttribute<T> implementations to CheckDataGenerator() - Fix interface detection filter to use AllInterfaces for indirect IDataSourceAttribute implementations - Fix CheckDataGenerator to use GloballyQualifiedNonGeneric() for correct open generic comparison - Add tests for TypedDataSourceAttribute parameter validation Co-authored-by: thomhurst <[email protected]>
|
@copilot We shouldn'thave to check if it's a |
…special-casing subtypes Address review feedback: instead of checking for ITypedDataSourceAttribute specifically, use the base IDataSourceAttribute interface to route ALL data source attributes to CheckDataGenerator(). Added continue statements to prevent double-dispatching for attributes already handled by specific handlers (Arguments, MethodDataSource). Co-authored-by: thomhurst <[email protected]>
Refactored in 42e4de5. The dispatch now uses |
Code reviewNo issues found. Checked for bugs and CLAUDE.md compliance. This PR correctly fixes three related bugs in the analyzer:
The logic changes are sound and the tests properly validate the fixes. |
TUnit0001 (argument/parameter mismatch) was not firing for
TypedDataSourceAttribute<T>/ITypedDataSourceAttribute<T>and other customIDataSourceAttributeimplementations, allowing mismatched test signatures to compile silently and fail only at runtime.Three bugs in
TestDataAnalyzer.cs:currentType.Interfaces(direct only) instead ofAllInterfaces, so types implementingIDataSourceAttributetransitively throughITypedDataSourceAttribute<T>were invisible to the analyzerCheckDataGenerator— only checked for specific base classes (DataSourceGeneratorAttribute/AsyncDataSourceGeneratorAttribute) by name; replaced with a genericIDataSourceAttributeinterface check that works for all data source implementations, including custom user-created ones. Addedcontinuestatements to prevent double-dispatching for attributes already handled by specific handlers (Arguments, MethodDataSource).ConstructedFrom.GloballyQualified()(returnsITypedDataSourceAttribute<T>) against backtick-arity format (ITypedDataSourceAttribute`1); fixed to useGloballyQualifiedNonGeneric()which strips type parameters for a correct match. This also fixes the same broken comparison that already existed inCheckDataGeneratorbut was unreachable due to the dispatch bug.Original prompt
✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.