TestMethodAttribute Classe
Definição
Importante
Algumas informações se referem a produtos de pré-lançamento que podem ser substancialmente modificados antes do lançamento. A Microsoft não oferece garantias, expressas ou implícitas, das informações aqui fornecidas.
Esse atributo é usado para marcar métodos de teste.
[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
- Herança
-
TestMethodAttribute
- Derivado
- Atributos
Comentários
- Ao usar outros atributos como DataRowAttribute ou DynamicDataAttribute, o uso de TestMethodAttribute ainda é necessário.
- Os métodos de teste devem ser:
- public ou se DiscoverInternalsAttribute for usado, ele poderá ser interno.
- não estático
- não genérico
- não abstrato
- o tipo de retorno é
void, Taskou ValueTask. Sevoid, então não deveria serasync.
Construtores
| Nome | Description |
|---|---|
| TestMethodAttribute() |
Inicializa uma nova instância da classe TestMethodAttribute. |
| TestMethodAttribute(String, Int32) |
Inicializa uma nova instância da classe TestMethodAttribute. |
| TestMethodAttribute(String) |
Inicializa uma nova instância da classe TestMethodAttribute. |
Propriedades
| Nome | Description |
|---|---|
| DeclaringFilePath |
Obtém o caminho do arquivo que declara o atributo. |
| DeclaringLineNumber |
Obtém o número de linha dentro DeclaringFilePath que declara o atributo. |
| DisplayName |
Obtém ou define o nome de exibição do teste. |
| UnfoldingStrategy |
Obtém ou define a estratégia para desdobrar testes parametrizados. |
Métodos
| Nome | Description |
|---|---|
| Execute(ITestMethod) |
Executa um método de teste. |
| ExecuteAsync(ITestMethod) |
Executa um método de teste. |