diff --git a/analyzers/tests/SonarAnalyzer.UnitTest/TestCases/PrivateStaticMethodUsedOnlyByNestedClass.cs b/analyzers/tests/SonarAnalyzer.UnitTest/TestCases/PrivateStaticMethodUsedOnlyByNestedClass.cs index a777726e1a4..e2f6690e43c 100644 --- a/analyzers/tests/SonarAnalyzer.UnitTest/TestCases/PrivateStaticMethodUsedOnlyByNestedClass.cs +++ b/analyzers/tests/SonarAnalyzer.UnitTest/TestCases/PrivateStaticMethodUsedOnlyByNestedClass.cs @@ -185,3 +185,37 @@ void Foo() } } } + +public class EdgeCaseWithLongCommonPaths +{ + private static void StaticMethod() { } // Noncompliant {{Move this method inside 'InsideMiddleTwo'.}} + + public class MiddleOne + { + public class InsideMiddleTwo + { + public class Foo + { + public class FooLeaf + { + public void Method() => StaticMethod(); + } + } + + public class Bar + { + public void Method() => StaticMethod(); + public class BarLeaf + { + public void Method() => StaticMethod(); + } + } + } + } + public class MiddleThree { + public void StaticMethod() + { + } + public void Method() => StaticMethod(); + } +}