Beispiel #1
0
        public void GetCustomAttribute()
        {
            // Type
            var @thisClass = new System_Object_GetCustomAttributes_TestClass();
            var @thisEnum  = System_Object_GetCustomAttributes_TestEnum.Test;

            // Exemples
            var result1  = @thisClass.GetCustomAttributes <System_Object_GetCustomAttributes_CustomAttribute>();
            var result2  = @thisClass.GetCustomAttributes <System_Object_GetCustomAttributes_CustomAttribute>(false);
            var result3  = @thisClass.GetType().GetCustomAttributes <System_Object_GetCustomAttributes_CustomAttribute>();
            var result4  = @thisClass.GetType().GetCustomAttributes <System_Object_GetCustomAttributes_CustomAttribute>(false);
            var result5  = @thisClass.GetCustomAttributes();
            var result6  = @thisClass.GetCustomAttributes(false);
            var result7  = @thisEnum.GetCustomAttributes <System_Object_GetCustomAttributes_CustomAttribute>();
            var result8  = @thisEnum.GetCustomAttributes <System_Object_GetCustomAttributes_CustomAttribute>(false);
            var result9  = @thisEnum.GetCustomAttributes();
            var result10 = @thisEnum.GetCustomAttributes(false);

            // Unit Test
            Assert.AreEqual("Test Class", result1[0].Text);
            Assert.AreEqual("Test Class", result2[0].Text);
            Assert.AreEqual("Test Class", result3[0].Text);
            Assert.AreEqual("Test Class", result4[0].Text);
            Assert.AreEqual("Test Class", ((System_Object_GetCustomAttributes_CustomAttribute)result5[0]).Text);
            Assert.AreEqual("Test Class", ((System_Object_GetCustomAttributes_CustomAttribute)result6[0]).Text);
            Assert.AreEqual("Test Enum", result7[0].Text);
            Assert.AreEqual("Test Enum", result8[0].Text);
            Assert.AreEqual("Test Enum", ((System_Object_GetCustomAttributes_CustomAttribute)result9[0]).Text);
            Assert.AreEqual("Test Enum", ((System_Object_GetCustomAttributes_CustomAttribute)result10[0]).Text);
        }
        public void GetCustomAttribute()
        {
            // Type
            var @thisClass = new System_Object_GetCustomAttributes_TestClass();
            var @thisEnum = System_Object_GetCustomAttributes_TestEnum.Test;

            // Exemples
            var result1 = @thisClass.GetCustomAttributes<System_Object_GetCustomAttributes_CustomAttribute>();
            var result2 = @thisClass.GetCustomAttributes<System_Object_GetCustomAttributes_CustomAttribute>(false);
            var result3 = @thisClass.GetType().GetCustomAttributes<System_Object_GetCustomAttributes_CustomAttribute>();
            var result4 = @thisClass.GetType().GetCustomAttributes<System_Object_GetCustomAttributes_CustomAttribute>(false);
            var result5 = @thisClass.GetCustomAttributes();
            var result6 = @thisClass.GetCustomAttributes(false);
            var result7 = @thisEnum.GetCustomAttributes<System_Object_GetCustomAttributes_CustomAttribute>();
            var result8 = @thisEnum.GetCustomAttributes<System_Object_GetCustomAttributes_CustomAttribute>(false);
            var result9 = @thisEnum.GetCustomAttributes();
            var result10 = @thisEnum.GetCustomAttributes(false);

            // Unit Test
            Assert.AreEqual("Test Class", result1[0].Text);
            Assert.AreEqual("Test Class", result2[0].Text);
            Assert.AreEqual("Test Class", result3[0].Text);
            Assert.AreEqual("Test Class", result4[0].Text);
            Assert.AreEqual("Test Class", ((System_Object_GetCustomAttributes_CustomAttribute) result5[0]).Text);
            Assert.AreEqual("Test Class", ((System_Object_GetCustomAttributes_CustomAttribute) result6[0]).Text);
            Assert.AreEqual("Test Enum", result7[0].Text);
            Assert.AreEqual("Test Enum", result8[0].Text);
            Assert.AreEqual("Test Enum", ((System_Object_GetCustomAttributes_CustomAttribute) result9[0]).Text);
            Assert.AreEqual("Test Enum", ((System_Object_GetCustomAttributes_CustomAttribute) result10[0]).Text);
        }