private static void TestCore <TAttribute>(
            Type type, string expected, AttributesSource attributesSource, SearchMode searchMode)
            where TAttribute : class, ITestInterface
        {
            if (attributesSource != AttributesSource.All)
            {
                var result = attributesSource == AttributesSource.Assembly
                                        ? GetAttributesString <TAttribute>(type.Assembly, searchMode)
                                        : GetAttributesString <TAttribute>(type, searchMode);
                AreEqual(result, expected);
            }
            else
            {
                var bf     = BindingFlags.Instance | BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic;
                var result = GetAttributesString <TAttribute>(type.GetMethod("M", bf), searchMode);
                AreEqual(result, expected);

                if (searchMode != SearchMode.Attributes)                 // default do not honor inherit flag for properties / events
                {
                    result = GetAttributesString <TAttribute>(type.GetProperty("P", bf), searchMode);
                    AreEqual(result, expected.Replace(".M", ".P"));

                    result = GetAttributesString <TAttribute>(type.GetEvent("E", bf), searchMode);
                    AreEqual(result, expected.Replace(".M", ".E"));
                }
            }
        }
 public virtual bool HasAttributeInstance(IClrTypeName clrName, AttributesSource attributesSource) => false;
 public override bool HasAttributeInstance(IClrTypeName clrName, AttributesSource attributesSource) =>
 Attributes.HasAttributeInstance(clrName.FullName);
 public override IList <IAttributeInstance> GetAttributeInstances(IClrTypeName clrName, AttributesSource attributesSource) =>
 Attributes.GetAttributes(clrName).ToAttributeInstances(Module);
 public override IList <IAttributeInstance> GetAttributeInstances(AttributesSource attributesSource) =>
 Attributes.ToAttributeInstances(Module);
Exemple #6
0
 public abstract bool HasAttributeInstance(IClrTypeName clrName, AttributesSource attributesSource);
Exemple #7
0
 public abstract IList <IAttributeInstance> GetAttributeInstances(IClrTypeName clrName,
                                                                  AttributesSource attributesSource);
Exemple #8
0
 public override IList <IAttributeInstance> GetAttributeInstances(IClrTypeName clrName, AttributesSource source) =>
 EmptyList <IAttributeInstance> .Instance;
Exemple #9
0
 public IList <IAttributeInstance> GetAttributeInstances(AttributesSource attributesSource) =>
 FSharpSymbol.Attributes.ToAttributeInstances(Module);
Exemple #10
0
 public IList <IAttributeInstance> GetAttributeInstances(IClrTypeName clrName, AttributesSource attributesSource) =>
 FSharpSymbol.Attributes.GetAttributes(clrName.FullName).ToAttributeInstances(Module);
Exemple #11
0
 public bool HasAttributeInstance(IClrTypeName clrName, AttributesSource attributesSource) =>
 FSharpSymbol.Attributes.HasAttributeInstance(clrName.FullName);
Exemple #12
0
 public bool HasAttributeInstance(IClrTypeName clrName, AttributesSource attributesSource) =>
 Attrs.HasAttributeInstance(clrName);
Exemple #13
0
 public override bool HasAttributeInstance(IClrTypeName clrName, AttributesSource attributesSource) => false;
 public virtual IList <IAttributeInstance> GetAttributeInstances(AttributesSource attributesSource) =>
 EmptyList <IAttributeInstance> .Instance;
Exemple #15
0
 public abstract IList <IAttributeInstance> GetAttributeInstances(AttributesSource attributesSource);
 public virtual IList <IAttributeInstance> GetAttributeInstances(IClrTypeName clrName, AttributesSource attributesSource) =>
 EmptyList <IAttributeInstance> .Instance;
Exemple #17
0
 public override IList <IAttributeInstance> GetAttributeInstances(AttributesSource source) =>
 EmptyList <IAttributeInstance> .Instance;