/// <summary> /// Includes the <paramref name="methodName"/> for checks for <see cref="ArgumentNullException"/>. /// Overrides any method rules that may exclude the <paramref name="methodName"/>. /// </summary> /// <param name="fixture">The fixture.</param> /// <param name="methodName">The method name.</param> /// <param name="typeFullName">The <see cref="Type.FullName"/> of the <see cref="Type"/>.</param> /// <returns>The <paramref name="fixture"/>.</returns> /// <exception cref="ArgumentNullException">The <paramref name="fixture"/> or <paramref name="methodName"/> /// parameters are <see langword="null"/>.</exception> public static IArgumentNullExceptionFixture IncludeMethod( this IArgumentNullExceptionFixture fixture, string methodName, string typeFullName = null) { if (fixture == null) { throw new ArgumentNullException(nameof(fixture)); } if (string.IsNullOrWhiteSpace(methodName)) { throw new ArgumentNullException(nameof(methodName)); } IRegexFilter regexFilter = fixture.GetRegexFilter(); regexFilter.IncludeMethod(methodName, typeFullName); return(fixture); }
/// <summary> /// Includes the <paramref name="parameterName"/> for checks for <see cref="ArgumentNullException"/>. Overrides /// any parameter rules that may exclude the <paramref name="parameterName"/>. /// </summary> /// <param name="filter">The <see cref="Regex"/> filter.</param> /// <param name="parameterName">The parameter name.</param> /// <param name="typeFullName">The <see cref="Type.FullName"/> of the <see cref="Type"/>.</param> /// <param name="methodName">The method name.</param> /// <returns>The <paramref name="filter"/>.</returns> /// <exception cref="ArgumentNullException">The <paramref name="filter"/> or <paramref name="parameterName"/> /// parameters are <see langword="null"/>.</exception> public static IRegexFilter IncludeParameter( this IRegexFilter filter, string parameterName, string typeFullName = null, string methodName = null) { // If the method or type type is specified ensure they are included // otherwise the parameter may never be included. if (!string.IsNullOrWhiteSpace(methodName)) { filter.IncludeMethod(methodName, typeFullName); } else if (!string.IsNullOrWhiteSpace(typeFullName)) { filter.IncludeType(typeFullName); } return(filter.AddParameterRule( parameterName, include: true, typeFullName: typeFullName, methodName: methodName)); }
/// <summary> /// Includes the <paramref name="methodName"/> for checks for <see cref="ArgumentNullException"/>. Overrides any /// method rules that may exclude the <paramref name="methodName"/>. /// </summary> /// <param name="filter">The <see cref="Regex"/> filter.</param> /// <param name="methodName">The method name.</param> /// <param name="type">The type.</param> /// <returns>The <paramref name="filter"/>.</returns> /// <exception cref="ArgumentNullException">The <paramref name="filter"/> or <paramref name="methodName"/> /// parameters are <see langword="null"/>.</exception> public static IRegexFilter IncludeMethod(this IRegexFilter filter, string methodName, Type type) { return(filter.IncludeMethod(methodName, type != null ? type.FullName : null)); }