示例#1
0
        public bool TryGetApiNamedType(Type clrType, out IApiNamedType apiNamedType)
        {
            if (clrType != null)
            {
                return(this.ClrTypeToApiNamedTypeDictionary.TryGetValue(clrType, out apiNamedType));
            }

            apiNamedType = null;
            return(false);
        }
示例#2
0
        public bool TryGetApiNamedType(string apiName, out IApiNamedType apiNamedType)
        {
            if (!String.IsNullOrWhiteSpace(apiName))
            {
                return(this.ApiNameToApiNamedTypeDictionary.TryGetValue(apiName, out apiNamedType));
            }

            apiNamedType = null;
            return(false);
        }
        /// <summary>Try and get the API named type by CLR type.</summary>
        /// <typeparam name="TEnumeration">CLR type to lookup the API named type by.</typeparam>
        /// <param name="apiNamedType">The API named type if it exists in the API schema, null otherwise.</param>
        /// <returns>True if API named type exists in the API schema, false otherwise.</returns>
        public static bool TryGetApiNamedType <TEnumeration>(this IApiSchema apiSchema, out IApiNamedType apiNamedType)
        {
            Contract.Requires(apiSchema != null);

            var clrType = typeof(TEnumeration);

            return(apiSchema.TryGetApiNamedType(clrType, out apiNamedType));
        }
 public TryGetApiNamedTypeWithClrTypeUnitTest(string name, IApiSchema apiSchema, IApiNamedType expectedApiNamedType)
     : base(name)
 {
     this.ApiSchema            = apiSchema;
     this.ExpectedApiNamedType = expectedApiNamedType;
 }