IsContextSpecification() private method

private IsContextSpecification ( Type classTypeToInvestigate ) : bool
classTypeToInvestigate System.Type
return bool
Exemplo n.º 1
0
        /// <summary>
        /// Checks whether the type is a candidate for the aspect to apply to it.
        /// </summary>
        /// <param name="type">the type to check if it needs the attribute.</param>
        /// <returns><c>true</c> if any of the <see cref="instanceLevelRules"/> attribute needs to be applied to the type; <c>false</c> otherwise.</returns>
        public override bool CompileTimeValidate(Type type)
        {
            if (!TypeInvestigationService.IsContextSpecification(type))
            {
                return(false);
            }

            var validates = false;

// ReSharper disable once LoopCanBeConvertedToQuery
            foreach (var rule in this.instanceLevelRules)
            {
                // do not break as some validators raise errors.
                validates = validates | rule.CompileTimeValidate(type);
            }

            return(validates);
        }
 /// <summary>
 /// Checks if the passed class contains any nested test fixture classes.
 /// </summary>
 /// <param name="type">
 /// The type of the class to check.
 /// </param>
 /// <returns>
 /// <c>true</c> if the passed class contains any any nested test fixture classes, <c>false</c> otherwise.
 /// </returns>
 public override bool CompileTimeValidate(Type type)
 {
     // Use reflection to find <see cref="TestFixtureAttribute"/>, instead of binding to the NUnit type directly.
     // This prevents versioning issues with PostSharp when applying the aspect at compile-time.
     return(TypeInvestigationService.IsContextSpecification(type) && base.CompileTimeValidate(type));
 }