Exemple #1
0
        public static void Verify_Component_Adapters_Contain_Valid_Unity3D_Types(Type adapterType)
        {
            //arrange
            EngineComponentAdapterAttribute adapterAttri = adapterType.GetCustomAttribute <EngineComponentAdapterAttribute>(false);

            //assert
            Assert.IsTrue(adapterAttri.ActualEngineType.Assembly == typeof(UnityEngine.Object).Assembly, "Type {0} doesn't seem to be a UnityEngine type adapter. Check {1} attribute.",
                          adapterType.FullName, typeof(EngineComponentAdapterAttribute).FullName);
        }
Exemple #2
0
        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;
 }