public static ClrTypeReference FromSchemaType <T>() where T : ITypeSystemMember { return(new ClrTypeReference( typeof(T), SchemaTypeReference.InferTypeContext(typeof(T)))); }
public void SchemaTypeReference_InferTypeContext_From_RuntimeType_None() { // arrange // act TypeContext context = SchemaTypeReference.InferTypeContext(typeof(Foo)); // assert Assert.Equal(TypeContext.None, context); }
public void SchemaTypeReference_InferTypeContext_Object_From_String_None() { // arrange // act TypeContext context = SchemaTypeReference.InferTypeContext((object)"foo"); // assert Assert.Equal(TypeContext.None, context); }
public void SchemaTypeReference_InferTypeContext_Object_From_SchemaType() { // arrange // act TypeContext context = SchemaTypeReference.InferTypeContext((object)typeof(ObjectType <Foo>)); // assert Assert.Equal(TypeContext.Output, context); }
public static ClrTypeReference FromSchemaType(Type schemaType) { if (schemaType == null) { throw new ArgumentNullException(nameof(schemaType)); } if (typeof(ITypeSystemMember).IsAssignableFrom(schemaType)) { return(new ClrTypeReference( schemaType, SchemaTypeReference.InferTypeContext(schemaType))); } throw new ArgumentException( TypeResources.ClrTypeReference_OnlyTsosAreAllowed); }
public static ClrTypeReference FromSchemaType(Type schemaType) { if (schemaType == null) { throw new ArgumentNullException(nameof(schemaType)); } if (typeof(ITypeSystem).IsAssignableFrom(schemaType)) { return(new ClrTypeReference( schemaType, SchemaTypeReference.InferTypeContext(schemaType))); } // TODO : resources throw new ArgumentException( "Only type system objects are allowed."); }