Skip to content

Commit 202a8eb

Browse files
committed
Fix reading of custom attributes (from @licon4812)
1 parent f561810 commit 202a8eb

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

Xunit.v3.Priority/PriorityOrderer.cs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,9 @@ public IReadOnlyCollection<TTestCase> OrderTestCases<TTestCase>(IReadOnlyCollect
5858

5959
private int PriorityForTest(IXunitTestCase testCase, int defaultPriority)
6060
{
61-
var priorityAttribute = testCase.TestMethod.Method.GetCustomAttribute<PriorityAttribute>(true);
61+
var priorityAttribute = testCase.TestMethod.Method
62+
.GetCustomAttributes<PriorityAttribute>()
63+
.SingleOrDefault();
6264
return priorityAttribute?.Priority ?? defaultPriority;
6365
}
6466

@@ -67,7 +69,7 @@ private int DefaultPriorityForClass(IXunitTestCase testCase)
6769
var testClass = testCase.TestMethod.TestClass.Class;
6870
if (!_defaultPriorities.TryGetValue(testClass.Name, out var result))
6971
{
70-
var defaultAttribute = testClass.GetCustomAttribute<PriorityAttribute>(true);
72+
var defaultAttribute = testClass.GetCustomAttributes<DefaultPriorityAttribute>().SingleOrDefault();
7173
result = defaultAttribute?.Priority ?? int.MaxValue;
7274
_defaultPriorities[testClass.Name] = result;
7375
}

0 commit comments

Comments
 (0)