Ejemplo n.º 1
0
 protected ProcessableComponent(
     ProcessableComponentType type,
     UnderlyingComponentType underlyingComponent,
     string name,
     string fullName,
     Collection <CustomAttribute> customAttributes,
     DeclaringComponentType declaringComponent,
     ModuleDefinition declaringModule)
 {
     Type = type;
     UnderlyingComponent = underlyingComponent;
     Name               = name;
     FullName           = fullName;
     CustomAttributes   = customAttributes;
     DeclaringComponent = declaringComponent;
     DeclaringModule    = declaringModule;
 }
Ejemplo n.º 2
0
 public Injected1Attribute(ProcessableComponentType component, Type type, int nameHash, string name)
 {
 }
Ejemplo n.º 3
0
        private static void CheckAttribute(CustomAttributeData att, Type attributeType, string componentName, ProcessableComponentType componentType, Type typeType)
        {
            if (attributeType == typeof(Injected1Attribute))
            {
                Assert.AreEqual(attributeType, att.AttributeType);
                Assert.AreEqual(4, att.ConstructorArguments.Count);

                Assert.AreEqual(typeof(ProcessableComponentType), att.ConstructorArguments[0].ArgumentType);
                Assert.AreEqual((int)componentType, att.ConstructorArguments[0].Value);

                Assert.AreEqual(typeof(Type), att.ConstructorArguments[1].ArgumentType);
                Assert.AreEqual(typeType, att.ConstructorArguments[1].Value);

                Assert.AreEqual(typeof(int), att.ConstructorArguments[2].ArgumentType);
                Assert.AreEqual(componentName.GetHashCode(), att.ConstructorArguments[2].Value);

                Assert.AreEqual(typeof(string), att.ConstructorArguments[3].ArgumentType);
                Assert.AreEqual(componentName, att.ConstructorArguments[3].Value);
            }
            else if (attributeType == typeof(Injected2Attribute))
            {
                Assert.AreEqual(attributeType, att.AttributeType);
                Assert.AreEqual(4, att.ConstructorArguments.Count);

                Assert.AreEqual(typeof(ProcessableComponentType[]), att.ConstructorArguments[0].ArgumentType);
                foreach (var item in (IEnumerable <CustomAttributeTypedArgument>)att.ConstructorArguments[0].Value)
                {
                    Assert.AreEqual(typeof(ProcessableComponentType), item.ArgumentType);
                    Assert.AreEqual((int)componentType, item.Value);
                }

                Assert.AreEqual(typeof(Type[]), att.ConstructorArguments[1].ArgumentType);
                foreach (var item in (IEnumerable <CustomAttributeTypedArgument>)att.ConstructorArguments[1].Value)
                {
                    Assert.AreEqual(typeof(Type), item.ArgumentType);
                    Assert.AreEqual(typeType, item.Value);
                }

                Assert.AreEqual(typeof(int[]), att.ConstructorArguments[2].ArgumentType);
                foreach (var item in (IEnumerable <CustomAttributeTypedArgument>)att.ConstructorArguments[2].Value)
                {
                    Assert.AreEqual(typeof(int), item.ArgumentType);
                    Assert.AreEqual(componentName.GetHashCode(), item.Value);
                }

                Assert.AreEqual(typeof(string[]), att.ConstructorArguments[3].ArgumentType);
                foreach (var item in (IEnumerable <CustomAttributeTypedArgument>)att.ConstructorArguments[3].Value)
                {
                    Assert.AreEqual(typeof(string), item.ArgumentType);
                    Assert.AreEqual(componentName, item.Value);
                }
            }
            else
            {
                throw new InvalidOperationException();
            }
        }
Ejemplo n.º 4
0
 protected void AddSupportedComponent(ProcessableComponentType componentType)
 {
     supportedComponents.Add(componentType);
 }