Skip to content
Merged
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
15 changes: 12 additions & 3 deletions TUnit.Core/Helpers/AttributeDictionaryHelper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -27,12 +27,21 @@ public static IReadOnlyDictionary<Type, IReadOnlyList<Attribute>> ToAttributeDic
var type = attr.GetType();
if (!result.TryGetValue(type, out var list))
{
var newList = new List<Attribute> { attr };
result[type] = newList;
var newCollection = new [] { attr };
result[type] = newCollection;
}
else
{
((List<Attribute>)list).Add(attr);
// first attribute is added to an array, move to a list for addtional values
if (list is Attribute[])
{
var newlist = new List<Attribute> { list[0], attr };
result[type] = newlist;
}
else
{
((List<Attribute>)list).Add(attr);
}
}
}

Expand Down
Loading