public void GetTypeName_FromAttribute() { var type = typeof(TypeDescriptionProviderAttribute); var attribute = new TypeDescriptionProviderAttribute(type); Assert.Equal(type.AssemblyQualifiedName, attribute.TypeName); }
public void GetTypeName_FromString() { var name = "name"; var attribute = new TypeDescriptionProviderAttribute(name); Assert.Equal(name, attribute.TypeName); }
/// <summary> /// Tests that the public parameterless constructors of types passed to the /// constructors of System.ComponentModel.TypeDescriptionProviderAttribute /// property are preserved when needed in a trimmed application. /// </summary> static int Main(string[] args) { TypeDescriptionProviderAttribute attr = new TypeDescriptionProviderAttribute("Program+MyTypeDescriptionProvider"); if (!RunTest(attr)) { return(-1); } attr = new TypeDescriptionProviderAttribute(typeof(MyOtherTypeDescriptionProvider)); if (!RunTest(attr)) { return(-1); } return(100); }
private static bool RunTest(TypeDescriptionProviderAttribute attr) { Type providerType = Type.GetType(attr.TypeName); if (providerType != null && typeof(TypeDescriptionProvider).IsAssignableFrom(providerType)) { TypeDescriptionProvider provider = (TypeDescriptionProvider)Activator.CreateInstance(providerType); if (provider == null) { return(false); } } else { return(false); } return(true); }
public void Ctor_Type(Type type) { var attribute = new TypeDescriptionProviderAttribute(type); Assert.Equal(type.AssemblyQualifiedName, attribute.TypeName); }
public void Ctor_String(string typeName) { var attribute = new TypeDescriptionProviderAttribute(typeName); Assert.Equal(typeName, attribute.TypeName); }