/// <summary> /// Gets a list of properties across all <see cref="XliffElement"/> types that are attributed with /// <see cref="SchemaEntityAttribute"/>, optionally excluding abstract types. /// </summary> /// <param name="skipAbstractTypes">True to ignore abstract types, false to include them.</param> /// <returns>A list of types and their associated properties. All types are classes that derive from /// <see cref="XliffElement"/>.</returns> private static List <Tuple <Type, PropertyInfo> > GetSchemaEntityProperties(bool skipAbstractTypes) { List <Tuple <Type, PropertyInfo> > result; result = new List <Tuple <Type, PropertyInfo> >(); foreach (Type type in XliffElementPropertiesTests.GetXliffElementTypes()) { IEnumerable <PropertyInfo> propertyList; if (skipAbstractTypes && type.IsAbstract) { continue; } propertyList = XliffElementPropertiesTests.GetSchemaEntityProperties(type); foreach (PropertyInfo property in propertyList) { result.Add(new Tuple <Type, PropertyInfo>(type, property)); } } // // Make sure this method worked correctly. // Assert.IsTrue(result.Count > 0, "GetSchemaEntityProperties failed to return items."); return(result); }
public void XliffElement_XliffElementsDefaultCtor() { foreach (Type type in XliffElementPropertiesTests.GetXliffElementTypes()) { const BindingFlags flags = BindingFlags.Instance | BindingFlags.NonPublic | BindingFlags.Public; ConstructorInfo ctor; object instance; if (type.IsAbstract) { continue; } Console.WriteLine(type.FullName); ctor = type.GetConstructor(flags, null, XliffElementPropertiesTests._emptyTypes, null); Assert.IsNotNull(ctor); instance = ctor.Invoke(XliffElementPropertiesTests._emptyObjects); Assert.IsNotNull(instance); } }