public static void Verify_Component_Adapters_Marked_With_Valid_Adapter_Constructors(Type adapterType) { //arrange EngineComponentAdapterConstructorAttribute constructorAttri = adapterType.GetConstructors(System.Reflection.BindingFlags.Public | System.Reflection.BindingFlags.Instance) .Select(x => x.GetCustomAttribute <EngineComponentAdapterConstructorAttribute>(false)) .Where(x => x != null) .FirstOrDefault(); EngineComponentAdapterAttribute adapterAttri = adapterType.GetCustomAttribute <EngineComponentAdapterAttribute>(false); //assert Assert.NotNull(constructorAttri, "Failed to find constructor metadata marker for: {0}", adapterType.ToString()); Assert.AreEqual(adapterAttri.ActualEngineType, constructorAttri.EngineTypeForConstruction, "Expected same types for metadata pair."); }
public ComponentData(EngineComponentAdapterAttribute adapterMetadata, EngineComponentAdapterConstructorAttribute constructorMetadata, Type adapterType) { AdapterType = adapterType; AdapterMarkMetadata = adapterMetadata; AdapterConstructorMetadata = constructorMetadata; }