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