private void InitializeTest(Type typeInLibraryToTest) { BaseType = typeof(ViewModelBase); AllTypes = new TypeList(); AllTypes.AddRange(typeInLibraryToTest.Assembly.GetTypes()); AllTypesToCheck = new TypeList(); DataTypesToCheck = new TypeList(); TypeProperties = new Dictionary<Type, PropertyInfo[]>(); foreach (Type currentType in AllTypes) { if (currentType.IsAbstract) continue; if (ReflectionUtil.IsClassOfType(currentType, BaseType)) { AllTypesToCheck.Add(currentType); if (ReflectionUtil.IsClassOfType(currentType, BaseType)) DataTypesToCheck.Add(currentType); PropertyInfo[] properties = currentType.GetProperties(); List<PropertyInfo> finalProperties = new List<PropertyInfo>(); foreach (PropertyInfo current in properties) { NotMappedAttribute notMappedAttribute = current.GetCustomAttribute<NotMappedAttribute>(); if (notMappedAttribute != null) continue; finalProperties.Add(current); } TypeProperties.Add(currentType, finalProperties.ToArray()); } } }
public void GetAllTypes() { assemblyDef = AssemblyFactory.GetAssembly(AssemblyFile); foreach (ModuleDefinition module in assemblyDef.Modules) { TypeList.AddRange(GetAllTypes(module.Types)); } }
public EmoteTypeAttribute(params EmoteType[] emoteTypes) { TypeList.AddRange(emoteTypes); }
public void ExtensionsTypeIsNumericTest() { TypeList numericTypesToCheck = new TypeList(); TypeList typesToCheck = new TypeList(); numericTypesToCheck.AddRange(typeof(char), typeof(int), typeof(decimal), typeof(double), typeof(Single), typeof(long), typeof(byte)); typesToCheck.AddRange(typeof(object), typeof(string), typeof(TypeList)); foreach (Type typeToCheck in numericTypesToCheck) { Assert.IsTrue(typeToCheck.IsNumeric()); Assert.IsFalse(typeToCheck.IsNotNumeric()); } foreach (Type typeToCheck in typesToCheck) { Assert.IsFalse(typeToCheck.IsNumeric()); Assert.IsTrue(typeToCheck.IsNotNumeric()); } }
/// <summary> /// Add all types in a module into TypeList. /// </summary> /// <param name="module">module to scan</param> public void ScanModule(ModuleDefinition module) { TypeList.AddRange(module.Types); }