Repository: dotnet/runtime
File: src/libraries/Common/tests/System/FunctionPointerTests.cs (C#)

Code before:

            // Fields for visibility tests
            public delegate* managed<int, void> Field_PublicParam;
            private delegate* managed<PrivateClass> Field_PrivateReturn;
            private delegate* managed<PrivateClass, void> Field_PrivateParam;
#pragma warning restore 0649, 0169

            public delegate* managed<int> Prop_Int { get; }
            public delegate* managed<MyClass> Prop_MyClass { get; }

            public delegate* managed<int> MethodReturnValue1() => default;
            public delegate* managed<int> MethodReturnValue2() => default;

            public delegate* unmanaged[Stdcall, MemberFunction]<string, ref bool*, MyClass, in MyStruct, double> SeveralArguments() => default;
            public delegate*<in int, out int, void> RequiredModifiers() => default;

            public delegate*<T> GenericReturnValue<T>() => default;
            public bool GenericArgument<T>(int x, delegate*<T[], void> fptr) => default;

            public class MyClass { }
            public struct MyStruct { }
            private class PrivateClass { }
        }

        /// <summary>
        /// A mock function pointer type used to test the abstract ContainsGenericParameters implementation.
        /// </summary>
        private sealed class MockFunctionPointerType : MockType
        {
            private readonly Type _returnType;
            private readonly Type[] _parameterTypes;

            public MockFunctionPointerType(Type returnType, Type[] parameterTypes)
            {
                _returnType = returnType;
                _parameterTypes = parameterTypes ?? Type.EmptyTypes;
            }

            protected override bool HasElementTypeImpl() => false;
            public override bool IsGenericParameter => false;
            public override bool IsFunctionPointer => true;
            public override Type GetFunctionPointerReturnType() => _returnType;
            public override Type[] GetFunctionPointerParameterTypes() => _parameterTypes;
        }

        /// <summary>
        /// A mock type that contains generic parameters.
        /// </summary>
        private sealed class MockGenericParameterType : MockType
        {
            public override bool ContainsGenericParameters => true;

Review comment (refactor):
Move this test to src\libraries\System.Runtime\tests\System.Runtime.Tests\System\Type\TypeTests.cs. It is going to fix the build break.

Code after:

            // Fields for visibility tests
            public delegate* managed<int, void> Field_PublicParam;
            private delegate* managed<PrivateClass> Field_PrivateReturn;
            private delegate* managed<PrivateClass, void> Field_PrivateParam;
#pragma warning restore 0649, 0169

            public delegate* managed<int> Prop_Int { get; }
            public delegate* managed<MyClass> Prop_MyClass { get; }

            public delegate* managed<int> MethodReturnValue1() => default;
            public delegate* managed<int> MethodReturnValue2() => default;

            public delegate* unmanaged[Stdcall, MemberFunction]<string, ref bool*, MyClass, in MyStruct, double> SeveralArguments() => default;
            public delegate*<in int, out int, void> RequiredModifiers() => default;

            public delegate*<T> GenericReturnValue<T>() => default;
            public bool GenericArgument<T>(int x, delegate*<T[], void> fptr) => default;

            public class MyClass { }
            public struct MyStruct { }
            private class PrivateClass { }
        }
    }
}