test/Shared/FunctionalTests/MetaTests.cs
/// <summary>
/// Checks the type for any test methods. 
/// Assumes any method attribute with an Xunit namespace indicates a test method.
/// </summary>
/// <param name="type"> Type to be checked. </param>
/// <returns> True if the type is a test class, false otherwise. </returns>
Checks the type for any test methods.
Assumes any method attribute with an Xunit namespace indicates a test method.
Checks the type for any test methods . Assumes any method attribute with an Xunit namespace indicates a test method .
private bool IsTypeTestClass(Type type)
        {
            return type.GetDeclaredMethods()
                .Any(method => method.GetCustomAttributes<Attribute>(inherit: true)
                    .Any(attribute =>
                    {
                        var attribType = attribute.TypeId as Type;
                        return attribType != null && attribType.Namespace == "Xunit";    
                    }));
        }
private bool IsTypeTestClass ( Type type ) { return type . GetDeclaredMethods ( ) . Any ( method => method . GetCustomAttributes < Attribute > ( inherit : true ) . Any ( attribute => { var attribType = attribute . TypeId as Type ; return attribType != null && attribType . Namespace == " " ; } ) ) ; }
Checks the type for any test methods.
Checks the type for any test methods .
True if the type is a test class, false otherwise.
True if the type is a test class false otherwise .
type
Type
Type to be checked.
Type to be checked .