Class Aver.ThrowsAttribute
Aver that method throws an exception of type
Inheritance
System.Object
System.Attribute
Aver.ThrowsAttribute
Inherited Members
System.Attribute.Equals(System.Object)
System.Attribute.GetCustomAttribute(System.Reflection.Assembly, System.Type)
System.Attribute.GetCustomAttribute(System.Reflection.Assembly, System.Type, System.Boolean)
System.Attribute.GetCustomAttribute(System.Reflection.MemberInfo, System.Type)
System.Attribute.GetCustomAttribute(System.Reflection.MemberInfo, System.Type, System.Boolean)
System.Attribute.GetCustomAttribute(System.Reflection.Module, System.Type)
System.Attribute.GetCustomAttribute(System.Reflection.Module, System.Type, System.Boolean)
System.Attribute.GetCustomAttribute(System.Reflection.ParameterInfo, System.Type)
System.Attribute.GetCustomAttribute(System.Reflection.ParameterInfo, System.Type, System.Boolean)
System.Attribute.GetCustomAttributes(System.Reflection.Assembly)
System.Attribute.GetCustomAttributes(System.Reflection.Assembly, System.Boolean)
System.Attribute.GetCustomAttributes(System.Reflection.Assembly, System.Type)
System.Attribute.GetCustomAttributes(System.Reflection.Assembly, System.Type, System.Boolean)
System.Attribute.GetCustomAttributes(System.Reflection.MemberInfo)
System.Attribute.GetCustomAttributes(System.Reflection.MemberInfo, System.Boolean)
System.Attribute.GetCustomAttributes(System.Reflection.MemberInfo, System.Type)
System.Attribute.GetCustomAttributes(System.Reflection.MemberInfo, System.Type, System.Boolean)
System.Attribute.GetCustomAttributes(System.Reflection.Module)
System.Attribute.GetCustomAttributes(System.Reflection.Module, System.Boolean)
System.Attribute.GetCustomAttributes(System.Reflection.Module, System.Type)
System.Attribute.GetCustomAttributes(System.Reflection.Module, System.Type, System.Boolean)
System.Attribute.GetCustomAttributes(System.Reflection.ParameterInfo)
System.Attribute.GetCustomAttributes(System.Reflection.ParameterInfo, System.Boolean)
System.Attribute.GetCustomAttributes(System.Reflection.ParameterInfo, System.Type)
System.Attribute.GetCustomAttributes(System.Reflection.ParameterInfo, System.Type, System.Boolean)
System.Attribute.GetHashCode()
System.Attribute.IsDefaultAttribute()
System.Attribute.IsDefined(System.Reflection.Assembly, System.Type)
System.Attribute.IsDefined(System.Reflection.Assembly, System.Type, System.Boolean)
System.Attribute.IsDefined(System.Reflection.MemberInfo, System.Type)
System.Attribute.IsDefined(System.Reflection.MemberInfo, System.Type, System.Boolean)
System.Attribute.IsDefined(System.Reflection.Module, System.Type)
System.Attribute.IsDefined(System.Reflection.Module, System.Type, System.Boolean)
System.Attribute.IsDefined(System.Reflection.ParameterInfo, System.Type)
System.Attribute.IsDefined(System.Reflection.ParameterInfo, System.Type, System.Boolean)
System.Attribute.Match(System.Object)
System.Attribute.TypeId
System.Object.Equals(System.Object, System.Object)
System.Object.GetType()
System.Object.MemberwiseClone()
System.Object.ReferenceEquals(System.Object, System.Object)
System.Object.ToString()
Namespace: Azos
Assembly: Azos.dll
Syntax
[AttributeUsage(AttributeTargets.Method, AllowMultiple = false, Inherited = false)]
public sealed class ThrowsAttribute : Attribute
Constructors
ThrowsAttribute()
Declaration
public ThrowsAttribute()
ThrowsAttribute(Type)
Declaration
public ThrowsAttribute(Type expected)
Parameters
Type | Name | Description |
---|---|---|
System.Type | expected |
ThrowsAttribute(Type, String)
Declaration
public ThrowsAttribute(Type expected, string msg)
Parameters
Type | Name | Description |
---|---|---|
System.Type | expected | |
System.String | msg |
Properties
ExactType
Declaration
public bool ExactType { get; set; }
Property Value
Type | Description |
---|---|
System.Boolean |
ExceptionType
Declaration
public Type ExceptionType { get; set; }
Property Value
Type | Description |
---|---|
System.Type |
Message
Declaration
public string Message { get; set; }
Property Value
Type | Description |
---|---|
System.String |
MsgMatch
Declaration
public Aver.ThrowsAttribute.MatchType MsgMatch { get; set; }
Property Value
Type | Description |
---|---|
Aver.ThrowsAttribute.MatchType |
Methods
CheckMethodError(MethodInfo, Exception, String)
Checks to see if the method has Throws attribute specified and if it does whether the error matches the required condition. Returns true if the error clause is specified and matches, false if the Throws is not specified, throws on mismatch
Declaration
public static bool CheckMethodError(MethodInfo method, Exception error, string from = null)
Parameters
Type | Name | Description |
---|---|---|
System.Reflection.MethodInfo | method | |
System.Exception | error | |
System.String | from |
Returns
Type | Description |
---|---|
System.Boolean |