-
-
Notifications
You must be signed in to change notification settings - Fork 95
Allow multiple property values with the same key #2485
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
There was a problem hiding this comment.
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 introduces support for storing multiple property values under the same key by changing the type of custom properties from single string values to collections of strings. Key changes include updating test methods, modifying public API signatures, and revising property extraction and addition logic throughout the codebase.
- Updated CustomProperties type in test and core code from string to IReadOnlyList.
- Improved property extraction and addition logic in TestExtensions and DiscoveredTestContext.
- Added new tests to verify the multi-value property behavior.
Reviewed Changes
Copilot reviewed 14 out of 14 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| TUnit.TestProject/CustomPropertyTests.cs | Updated GetDictionary() to use a list for property values. |
| TUnit.TestProject/Bugs/2481/Tests.cs | Added tests verifying multiple values per property key. |
| TUnit.PublicAPI/*.verified.txt | Updated CustomProperties type in API definitions. |
| TUnit.Engine/Services/TestFilterService.cs | Revised property bag construction to aggregate list results. |
| TUnit.Engine/Json/TestJson.cs | Changed property type for custom properties. |
| TUnit.Engine/Extensions/TestExtensions.cs | Introduced ExtractProperties to yield key-value pair properties. |
| TUnit.Engine.Tests/Bugs/Bug2481.cs | Added bug reproduction tests for multiple property values. |
| TUnit.Core/TestDetails.cs | Changed InternalCustomProperties to a concurrent dictionary and updated the getter. |
| TUnit.Core/DiscoveredTestContext.cs | Modified AddProperty to accumulate values in a list. |
Comments suppressed due to low confidence (1)
TUnit.Core/TestDetails.cs:119
- The CustomProperties getter references an undeclared 'field' for lazy initialization, which could lead to runtime errors. Consider defining and using a proper backing field or converting this to an auto-property with an initializer.
public IReadOnlyDictionary<string, IReadOnlyList<string>> CustomProperties => field ??= InternalCustomProperties.ToDictionary(
Fixes #2481