Exemple #1
0
        /// <summary>
        /// Checks if the signature of the supplied <paramref name="handlerMethod"/>
        /// is compatible with the signature expected by the supplied
        /// <paramref name="eventMeta"/>.
        /// </summary>
        /// <param name="eventMeta">The event to be checked against.</param>
        /// <param name="handlerMethod">
        /// The method signature to check for compatibility.
        /// </param>
        /// <returns>
        /// <see langword="true"/> if the signature of the supplied
        /// <paramref name="handlerMethod"/> is compatible with the signature
        /// expected by the supplied <paramref name="eventMeta"/>;
        /// <see langword="false"/> if not or either of the supplied
        /// parameters is <see langword="null"/>.
        /// </returns>
        /// <seealso cref="Spring.Util.DelegateInfo.IsSignatureCompatible(MethodInfo)"/>
        public static bool IsSignatureCompatible(
            EventInfo eventMeta, MethodInfo handlerMethod)
        {
            bool compatible = false;

            if (eventMeta != null &&
                DelegateInfo.IsDelegate(eventMeta.EventHandlerType))
            {
                compatible = new DelegateInfo(eventMeta.EventHandlerType)
                             .IsSignatureCompatible(handlerMethod);
            }
            return(compatible);
        }
Exemple #2
0
 public void IsDelegateWithNullType()
 {
     Assert.IsFalse(DelegateInfo.IsDelegate(null));
 }
Exemple #3
0
 public void IsDelegate()
 {
     Assert.IsTrue(DelegateInfo.IsDelegate(typeof(EventHandler)));
 }
Exemple #4
0
 public void IsDelegateWithBadType()
 {
     Assert.IsFalse(DelegateInfo.IsDelegate(typeof(string)));
 }