Repository: dotnet/runtime
File: src/libraries/System.Runtime/tests/System.Runtime.Tests/System/Type/TypeTests.cs (C#)

Code before:
            Assert.True(Type.GetTypeCode(typeof(TestGenericClass<TestClass>.NestedEnum)) == TypeCode.Int32);
        }

        public enum TestEnum
        {
            A,
            B,
            C
        }

        public class TestClass { }
        public class TestGenericClass<T>
        {
            public enum NestedEnum
            {
                A,
                B,
                C
            }
        }

        /// <summary>
        /// A mock function pointer type used to test the abstract ContainsGenericParameters implementation in Type.Helpers.cs.
        /// This inherits from Type directly (not MockType) so that it uses the base ContainsGenericParameters implementation.
        /// </summary>
        private sealed class MockFunctionPointerType : Type
        {
            private readonly Type _returnType;
            private readonly Type[] _parameterTypes;
            private static readonly Exception s_unexpected = new Exception("Did not expect to be called.");

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

            // Required for ContainsGenericParameters to work correctly
            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;

            // Required abstract members
            public override Assembly Assembly => throw s_unexpected;
            public override string AssemblyQualifiedName => throw s_unexpected;
            public override Type BaseType => throw s_unexpected;
            public override string FullName => throw s_unexpected;
            public override Guid GUID => throw s_unexpected;
            public override Module Module => throw s_unexpected;

Review comment (suggestion):
@copilot Rename this to `MockFunctionPointerType_ContainsGenericParameters`

Code after:
            Assert.True(Type.GetTypeCode(typeof(TestGenericClass<TestClass>.NestedEnum)) == TypeCode.Int32);
        }

        public enum TestEnum
        {
            A,
            B,
            C
        }

        public class TestClass { }
        public class TestGenericClass<T>
        {
            public enum NestedEnum
            {
                A,
                B,
                C
            }
        }

        /// <summary>
        /// A mock function pointer type used to test the abstract ContainsGenericParameters implementation in Type.Helpers.cs.
        /// This inherits from Type directly (not MockType) so that it uses the base ContainsGenericParameters implementation.
        /// </summary>
        private sealed class MockFunctionPointerType_ContainsGenericParameters : Type
        {
            private readonly Type _returnType;
            private readonly Type[] _parameterTypes;
            private static readonly Exception s_unexpected = new Exception("Did not expect to be called.");

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

            // Required for ContainsGenericParameters to work correctly
            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;

            // Required abstract members
            public override Assembly Assembly => throw s_unexpected;
            public override string AssemblyQualifiedName => throw s_unexpected;
            public override Type BaseType => throw s_unexpected;
            public override string FullName => throw s_unexpected;
            public override Guid GUID => throw s_unexpected;
            public override Module Module => throw s_unexpected;