Esempio n. 1
0
 private static void VerifyFieldsEquality(FieldInfo[] fieldInfo1, FieldInfo[] fieldInfo2)
 {
     if (TestHelper.AreNotNull(fieldInfo1, fieldInfo2))
     {
         Assert.AreEqual(fieldInfo1.Count(), fieldInfo2.Count());
         foreach (FieldInfo field1 in fieldInfo1)
         {
             FieldInfo field2 = fieldInfo2.First(f => f.Name == field1.Name);
             Assert.IsTrue(AreTypesEqual(field2.FieldType, field1.FieldType));
         }
     }
 }
Esempio n. 2
0
 private static void VerifyMethodsEquality(MethodInfo[] methods1, MethodInfo[] methods2)
 {
     if (TestHelper.AreNotNull(methods1, methods2))
     {
         Assert.AreEqual(methods1.Count(), methods2.Count());
         foreach (MethodInfo method1 in methods1)
         {
             MethodInfo method2 = GetMatchingMethod(methods2, method1);
             Assert.IsNotNull(method2, $"Could not find a method matching '{method1}' in t4 codegen generated assembly");
             TestHelper.VerifyAttributesEquality(method1.GetCustomAttributesData(), method2.GetCustomAttributesData());
         }
     }
 }
Esempio n. 3
0
 private static void VerifyMethodsEquality(MethodInfo[] methods1, MethodInfo[] methods2)
 {
     if (TestHelper.AreNotNull(methods1, methods2))
     {
         Assert.AreEqual(methods1.Count(), methods2.Count());
         foreach (MethodInfo method1 in methods1)
         {
             MethodInfo method2 = GetMatchingMethod(methods2, method1);
             Assert.IsNotNull(method2);
             TestHelper.VerifyAttributesEquality(method1.GetCustomAttributesData(), method2.GetCustomAttributesData());
         }
     }
 }
Esempio n. 4
0
 private static void VerifyPropertiesEquality(PropertyInfo[] properties1, PropertyInfo[] properties2)
 {
     if (TestHelper.AreNotNull(properties1, properties2))
     {
         Assert.AreEqual(properties1.Count(), properties2.Count());
         foreach (PropertyInfo prop1 in properties1)
         {
             PropertyInfo prop2 = properties2.First(p => p.Name == prop1.Name);
             Assert.IsNotNull(prop2, $"Could not find a property matching '{prop1.Name}' in t4 codegen generated assembly");
             Assert.IsTrue(AreTypesEqual(prop1.PropertyType, prop2.PropertyType));
             TestHelper.VerifyAttributesEquality(prop1.GetCustomAttributesData(), prop2.GetCustomAttributesData());
         }
     }
 }
Esempio n. 5
0
 private static void VerifyAttributesEquality(IList <CustomAttributeData> attributes1, IList <CustomAttributeData> attributes2)
 {
     if (TestHelper.AreNotNull(attributes1, attributes2))
     {
         Assert.AreEqual(attributes1.Count(), attributes2.Count());
         foreach (CustomAttributeData attr1 in attributes1)
         {
             CustomAttributeData attr2 = attributes2.First(a => a.ToString() == attr1.ToString());
             Assert.IsNotNull(attr2, $"Could not find an attribute matching '{attr1}' in t4 codegen generated assembly");
             Assert.AreEqual(attr1.ConstructorArguments.Count(), attr2.ConstructorArguments.Count());
             Assert.AreEqual(attr1.NamedArguments.Count, attr2.NamedArguments.Count);
         }
     }
 }
Esempio n. 6
0
 private static void VerifyPropertiesEquality(PropertyInfo[] properties1, PropertyInfo[] properties2)
 {
     if (TestHelper.AreNotNull(properties1, properties2))
     {
         Assert.AreEqual(properties1.Count(), properties2.Count());
         foreach (PropertyInfo prop1 in properties1)
         {
             PropertyInfo prop2 = properties2.First(p => p.Name == prop1.Name);
             Assert.IsNotNull(prop2);
             Assert.IsTrue(AreTypesEqual(prop1.PropertyType, prop2.PropertyType));
             TestHelper.VerifyAttributesEquality(prop1.GetCustomAttributesData(), prop2.GetCustomAttributesData());
         }
     }
 }
Esempio n. 7
0
 private static void VerifyAttributesEquality(IList <CustomAttributeData> attributes1, IList <CustomAttributeData> attributes2)
 {
     if (TestHelper.AreNotNull(attributes1, attributes2))
     {
         Assert.AreEqual(attributes1.Count(), attributes2.Count());
         foreach (CustomAttributeData attr1 in attributes1)
         {
             CustomAttributeData attr2 = attributes2.First(a => a.ToString() == attr1.ToString());
             Assert.IsNotNull(attr2);
             Assert.AreEqual(attr1.ConstructorArguments.Count(), attr2.ConstructorArguments.Count());
             Assert.AreEqual(attr1.NamedArguments.Count, attr2.NamedArguments.Count);
         }
     }
 }
Esempio n. 8
0
        private static void VerifyTypeEquality(Type[] t1, Type[] t2)
        {
            if (TestHelper.AreNotNull(t1, t2))
            {
                Assert.AreEqual(t1.Count(), t2.Count());
                foreach (Type type1 in t1)
                {
                    Type type2 = t2.First(e => e.FullName == type1.FullName);

                    TestHelper.VerifyAttributesEquality(type1.GetCustomAttributesData(), type2.GetCustomAttributesData());
                    TestHelper.VerifyPropertiesEquality(type1.GetProperties(), type2.GetProperties());
                    TestHelper.VerifyMethodsEquality(type1.GetMethods(), type2.GetMethods());
                    TestHelper.VerifyTypeEquality(type1.GetNestedTypes(), type2.GetNestedTypes());
                    TestHelper.VerifyFieldsEquality(type1.GetFields(), type2.GetFields());
                }
            }
        }