Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 7 additions & 5 deletions TUnit.Engine/Building/Collectors/AotTestDataCollector.cs
Original file line number Diff line number Diff line change
Expand Up @@ -155,15 +155,17 @@ private Task<TestMetadata> CreateMetadataFromDynamicDiscoveryResult(DynamicDisco

private static Attribute[] GetDynamicTestAttributes(DynamicDiscoveryResult result)
{
if (result.TestClassType == null)
{
return result.Attributes.ToArray();
}

// Merge explicitly provided attributes with inherited class/assembly attributes
// Order matches GetAllAttributes: method-level first (explicit), then class, then assembly
var attributes = new List<Attribute>(result.Attributes);

if (result.TestClassType != null)
{
attributes.AddRange(result.TestClassType.GetCustomAttributes().OfType<Attribute>());
attributes.AddRange(result.TestClassType.Assembly.GetCustomAttributes().OfType<Attribute>());
}
attributes.AddRange(result.TestClassType.GetCustomAttributes());
attributes.AddRange(result.TestClassType.Assembly.GetCustomAttributes());

return attributes.ToArray();
}
Expand Down
12 changes: 7 additions & 5 deletions TUnit.Engine/Discovery/ReflectionTestDataCollector.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1932,15 +1932,17 @@ private Task<TestMetadata> CreateMetadataFromDynamicDiscoveryResult(DynamicDisco

private static Attribute[] GetDynamicTestAttributes(DynamicDiscoveryResult result)
{
if (result.TestClassType == null)
{
return result.Attributes.ToArray();
}

// Merge explicitly provided attributes with inherited class/assembly attributes
// Order matches GetAllAttributes: method-level first (explicit), then class, then assembly
var attributes = new List<Attribute>(result.Attributes);

if (result.TestClassType != null)
{
attributes.AddRange(result.TestClassType.GetCustomAttributes().OfType<Attribute>());
attributes.AddRange(result.TestClassType.Assembly.GetCustomAttributes().OfType<Attribute>());
}
attributes.AddRange(result.TestClassType.GetCustomAttributes());
attributes.AddRange(result.TestClassType.Assembly.GetCustomAttributes());

return attributes.ToArray();
}
Expand Down
Loading