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);
public abstract bool HasAttributeInstance(IClrTypeName clrName, AttributesSource attributesSource);
public abstract IList <IAttributeInstance> GetAttributeInstances(IClrTypeName clrName, AttributesSource attributesSource);
public override IList <IAttributeInstance> GetAttributeInstances(IClrTypeName clrName, AttributesSource source) => EmptyList <IAttributeInstance> .Instance;
public IList <IAttributeInstance> GetAttributeInstances(AttributesSource attributesSource) => FSharpSymbol.Attributes.ToAttributeInstances(Module);
public IList <IAttributeInstance> GetAttributeInstances(IClrTypeName clrName, AttributesSource attributesSource) => FSharpSymbol.Attributes.GetAttributes(clrName.FullName).ToAttributeInstances(Module);
public bool HasAttributeInstance(IClrTypeName clrName, AttributesSource attributesSource) => FSharpSymbol.Attributes.HasAttributeInstance(clrName.FullName);
public bool HasAttributeInstance(IClrTypeName clrName, AttributesSource attributesSource) => Attrs.HasAttributeInstance(clrName);
public override bool HasAttributeInstance(IClrTypeName clrName, AttributesSource attributesSource) => false;
public virtual IList <IAttributeInstance> GetAttributeInstances(AttributesSource attributesSource) => EmptyList <IAttributeInstance> .Instance;
public abstract IList <IAttributeInstance> GetAttributeInstances(AttributesSource attributesSource);
public virtual IList <IAttributeInstance> GetAttributeInstances(IClrTypeName clrName, AttributesSource attributesSource) => EmptyList <IAttributeInstance> .Instance;
public override IList <IAttributeInstance> GetAttributeInstances(AttributesSource source) => EmptyList <IAttributeInstance> .Instance;