From ef93b9fcc30d7530a7b093d0c3e0b98adff8564e Mon Sep 17 00:00:00 2001 From: Pavel Mikula <57188685+pavel-mikula-sonarsource@users.noreply.github.com> Date: Fri, 14 Jul 2023 14:18:13 +0200 Subject: [PATCH] Rename --- analyzers/src/SonarAnalyzer.Common/Helpers/UnitTestHelper.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/analyzers/src/SonarAnalyzer.Common/Helpers/UnitTestHelper.cs b/analyzers/src/SonarAnalyzer.Common/Helpers/UnitTestHelper.cs index 76cd9f2c1f9..e10b28756f5 100644 --- a/analyzers/src/SonarAnalyzer.Common/Helpers/UnitTestHelper.cs +++ b/analyzers/src/SonarAnalyzer.Common/Helpers/UnitTestHelper.cs @@ -91,7 +91,7 @@ public static bool IsTestMethod(this IMethodSymbol method) => : method.AnyAttributeDerivesFromOrImplementsAny(KnownTestMethodAttributes); public static bool IsIgnoredTestMethod(this IMethodSymbol method) => - method.IsMsTestOrNUnitTestIgnored() + method.HasIgnoredAttribute() || method.FindXUnitTestAttribute().NamedArguments.Any(arg => arg.Key == "Skip"); public static bool HasExpectedExceptionAttribute(this IMethodSymbol method) => @@ -131,6 +131,6 @@ private static bool IsTestAttributeWithExpectedResult(AttributeData a) => private static bool IsXunitTestMethod(this IMethodSymbol methodSymbol) => methodSymbol.AnyAttributeDerivesFromAny(KnownTestMethodAttributesOfxUnit); - private static bool IsMsTestOrNUnitTestIgnored(this IMethodSymbol method) => + private static bool HasIgnoredAttribute(this IMethodSymbol method) => method.GetAttributes().Any(a => a.AttributeClass.IsAny(KnownIgnoreAttributes)); }