TestMethodAttribute Classe
Definizione
Importante
Alcune informazioni sono relative alla release non definitiva del prodotto, che potrebbe subire modifiche significative prima della release definitiva. Microsoft non riconosce alcuna garanzia, espressa o implicita, in merito alle informazioni qui fornite.
Questo attributo viene usato per contrassegnare i metodi di 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
- Ereditarietà
-
TestMethodAttribute
- Derivato
- Attributi
Commenti
- Quando si usano altri attributi come DataRowAttribute o DynamicDataAttribute, l'uso di TestMethodAttribute è ancora obbligatorio.
- I metodi di test devono essere:
- public, o se DiscoverInternalsAttribute viene usato, può essere interno.
- non statico
- non generico
- non astratto
- il tipo restituito
voidè , Tasko ValueTask. Sevoid, non dovrebbe essereasync.
Costruttori
| Nome | Descrizione |
|---|---|
| TestMethodAttribute() |
Inizializza una nuova istanza della classe TestMethodAttribute. |
| TestMethodAttribute(String, Int32) |
Inizializza una nuova istanza della classe TestMethodAttribute. |
| TestMethodAttribute(String) |
Inizializza una nuova istanza della classe TestMethodAttribute. |
Proprietà
| Nome | Descrizione |
|---|---|
| DeclaringFilePath |
Ottiene il percorso del file che dichiara l'attributo . |
| DeclaringLineNumber |
Ottiene il numero di riga all'interno DeclaringFilePath di che dichiara l'attributo . |
| DisplayName |
Ottiene o imposta il nome visualizzato per il test. |
| UnfoldingStrategy |
Ottiene o imposta la strategia per lo svolgimento di test con parametri. |
Metodi
| Nome | Descrizione |
|---|---|
| Execute(ITestMethod) |
Esegue un metodo di test. |
| ExecuteAsync(ITestMethod) |
Esegue un metodo di test. |