Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings
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
19 changes: 17 additions & 2 deletions 19 TUnit.Core/Helpers/ClassConstructorHelper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ public static class ClassConstructorHelper
TestBuilderContext testBuilderContext,
string testSessionId)
{
var classConstructorAttribute = attributes.OfType<ClassConstructorAttribute>().FirstOrDefault();
var classConstructorAttribute = GetClassConstructorAttribute(attributes);

if (classConstructorAttribute == null)
{
Expand Down Expand Up @@ -78,6 +78,21 @@ public static bool HasClassConstructorAttribute(Attribute[] attributes)
/// </summary>
public static ClassConstructorAttribute? GetClassConstructorAttribute(Attribute[] attributes)
{
return attributes.OfType<ClassConstructorAttribute>().FirstOrDefault();
return GetClassConstructorAttribute((IReadOnlyList<ClassConstructorAttribute>)attributes);
}

private static ClassConstructorAttribute? GetClassConstructorAttribute(IReadOnlyList<Attribute> attributes)
{
ClassConstructorAttribute? classConstructorAttribute = null;
foreach (Attribute attribute in attributes)
{
if (attribute is ClassConstructorAttribute classAttribute)
{
classConstructorAttribute = classAttribute;
break;
}
}

return classConstructorAttribute;
}
}
8 changes: 6 additions & 2 deletions 8 TUnit.Engine/Building/TestBuilder.cs
Original file line number Diff line number Diff line change
Expand Up @@ -947,13 +947,17 @@ public async Task<AbstractExecutableTest> BuildTestAsync(TestMetadata metadata,
private static string? GetBasicSkipReason(TestMetadata metadata, Attribute[]? cachedAttributes = null)
{
var attributes = cachedAttributes ?? metadata.AttributeFactory();
var skipAttributes = attributes.OfType<SkipAttribute>();

SkipAttribute? firstSkipAttribute = null;

// Check if all skip attributes are basic (non-derived) SkipAttribute instances
foreach (var skipAttribute in skipAttributes)
foreach (var attribute in attributes)
{
if (attribute is not SkipAttribute skipAttribute)
{
continue;
}

firstSkipAttribute ??= skipAttribute;

var attributeType = skipAttribute.GetType();
Expand Down
Loading
Morty Proxy This is a proxified and sanitized view of the page, visit original site.