UnityEngine.NUnit.Framework.Constraints.AttributeConstraint.Matches C# (CSharp) Method

Matches() public method

Determines whether the Type or other provider has the expected attribute and if its value matches the additional constraint specified.
public Matches ( object actual ) : bool
actual object
return bool
        public override bool Matches(object actual)
        {
            this.actual = actual;
            System.Reflection.ICustomAttributeProvider attrProvider =
                actual as System.Reflection.ICustomAttributeProvider;

            if (attrProvider == null)
                throw new ArgumentException(string.Format("Actual value {0} does not implement ICustomAttributeProvider", actual), "actual");

            Attribute[] attrs = (Attribute[])attrProvider.GetCustomAttributes(expectedType, true);
            if (attrs.Length == 0)
                throw new ArgumentException(string.Format("Attribute {0} was not found", expectedType), "actual");

            attrFound = attrs[0];
            return baseConstraint.Matches(attrFound);
        }