public void GetTypeName_FromAttribute()
        {
            var type      = typeof(TypeDescriptionProviderAttribute);
            var attribute = new TypeDescriptionProviderAttribute(type);

            Assert.Equal(type.AssemblyQualifiedName, attribute.TypeName);
        }
        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);
        }
        public void GetTypeName_FromString()
        {
            var name = "name";
            var attribute = new TypeDescriptionProviderAttribute(name);

            Assert.Equal(name, attribute.TypeName);
        }
예제 #5
0
    /// <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);
    }
예제 #6
0
    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);
    }
예제 #7
0
        public void Ctor_Type(Type type)
        {
            var attribute = new TypeDescriptionProviderAttribute(type);

            Assert.Equal(type.AssemblyQualifiedName, attribute.TypeName);
        }
예제 #8
0
        public void Ctor_String(string typeName)
        {
            var attribute = new TypeDescriptionProviderAttribute(typeName);

            Assert.Equal(typeName, attribute.TypeName);
        }