diff --git a/analyzers/tests/SonarAnalyzer.UnitTest/TestCases/PrivateStaticMethodUsedOnlyByNestedClass.cs b/analyzers/tests/SonarAnalyzer.UnitTest/TestCases/PrivateStaticMethodUsedOnlyByNestedClass.cs index a777726e1a4..6210a94aa03 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 'InsideMiddleOne'.}} + + public class MiddleOne + { + public class InsideMiddleOne + { + 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 MiddleTwo { + public void StaticMethod() + { + } + public void Method() => StaticMethod(); + } +}