TestMethodAttribute Classe
Définition
Important
Certaines informations portent sur la préversion du produit qui est susceptible d’être en grande partie modifiée avant sa publication. Microsoft exclut toute garantie, expresse ou implicite, concernant les informations fournies ici.
Cet attribut est utilisé pour marquer les méthodes de test.
[System.AttributeUsage(System.AttributeTargets.Method, AllowMultiple=false)]
public class TestMethodAttribute : Attribute
[System.AttributeUsage(System.AttributeTargets.Method)]
public class TestMethodAttribute : Attribute
[System.AttributeUsage(System.AttributeTargets.Method, Inherited=false)]
[System.Runtime.CompilerServices.Nullable(0)]
public class TestMethodAttribute : Attribute
[System.AttributeUsage(System.AttributeTargets.Method, Inherited=false)]
public class TestMethodAttribute : Attribute
[System.AttributeUsage(System.AttributeTargets.Method, AllowMultiple=false)]
public sealed class TestMethodAttribute : Attribute
[<System.AttributeUsage(System.AttributeTargets.Method, AllowMultiple=false)>]
type TestMethodAttribute = class
inherit Attribute
[<System.AttributeUsage(System.AttributeTargets.Method)>]
type TestMethodAttribute = class
inherit Attribute
[<System.AttributeUsage(System.AttributeTargets.Method, Inherited=false)>]
[<System.Runtime.CompilerServices.Nullable(0)>]
type TestMethodAttribute = class
inherit Attribute
[<System.AttributeUsage(System.AttributeTargets.Method, Inherited=false)>]
type TestMethodAttribute = class
inherit Attribute
Public Class TestMethodAttribute
Inherits Attribute
Public NotInheritable Class TestMethodAttribute
Inherits Attribute
- Héritage
-
TestMethodAttribute
- Dérivé
- Attributs
Remarques
- Lorsque vous utilisez d’autres attributs tels DataRowAttribute ou DynamicDataAttribute, l’utilisation est TestMethodAttribute toujours requise.
- Les méthodes de test doivent être les suivantes :
- public ou s’il DiscoverInternalsAttribute est utilisé, il peut être interne.
- non statique
- non générique
- pas abstrait
- le type de retour est soit
void, Tasksoit ValueTask. Sivoid, alors il ne devrait pas êtreasync.
Constructeurs
| Nom | Description |
|---|---|
| TestMethodAttribute() |
Initialise une nouvelle instance de la classe TestMethodAttribute. |
| TestMethodAttribute(String, Int32) |
Initialise une nouvelle instance de la classe TestMethodAttribute. |
| TestMethodAttribute(String) |
Initialise une nouvelle instance de la classe TestMethodAttribute. |
Propriétés
| Nom | Description |
|---|---|
| DeclaringFilePath |
Obtient le chemin d’accès du fichier qui déclare l’attribut. |
| DeclaringLineNumber |
Obtient le numéro de ligne dans DeclaringFilePath lequel l’attribut est déclaré. |
| DisplayName |
Obtient ou définit le nom complet du test. |
| UnfoldingStrategy |
Obtient ou définit la stratégie de déploiement de tests paramétrables. |
Méthodes
| Nom | Description |
|---|---|
| Execute(ITestMethod) |
Exécute une méthode de test. |
| ExecuteAsync(ITestMethod) |
Exécute une méthode de test. |