예제 #1
0
            internal static Type?GetNamedType(Type type)
            {
                if (type is null)
                {
                    throw new ArgumentNullException(nameof(type));
                }

                if (BaseTypes.IsNamedType(type))
                {
                    return(type);
                }

                if (type.IsGenericType)
                {
                    Type definition = type.GetGenericTypeDefinition();
                    if (typeof(ListType <>) == definition ||
                        typeof(NonNullType <>) == definition ||
                        typeof(NativeType <>) == definition)
                    {
                        return(GetNamedType(type.GetGenericArguments()[0]));
                    }
                }

                return(null);
            }
예제 #2
0
        public void IsNonGenericBaseType(Type type, bool expectedResult)
        {
            // act
            bool result = BaseTypes.IsNonGenericBaseType(type);

            // assert
            Assert.Equal(expectedResult, result);
        }
예제 #3
0
            internal static bool IsNonGenericBaseType(Type type)
            {
                if (type is null)
                {
                    throw new ArgumentNullException(nameof(type));
                }

                return(BaseTypes.IsNonGenericBaseType(type));
            }
            internal static bool IsSchemaType(Type type)
            {
                if (BaseTypes.IsNamedType(type))
                {
                    return(true);
                }

                if (type.IsGenericType)
                {
                    Type definition = type.GetGenericTypeDefinition();
                    if (typeof(ListType <>) == definition ||
                        typeof(NonNullType <>) == definition ||
                        typeof(NativeType <>) == definition)
                    {
                        return(IsSchemaType(type.GetGenericArguments()[0]));
                    }
                }

                return(false);
            }