TestMethodAttribute Kelas
Definisi
Penting
Beberapa informasi terkait produk prarilis yang dapat diubah secara signifikan sebelum dirilis. Microsoft tidak memberikan jaminan, tersirat maupun tersurat, sehubungan dengan informasi yang diberikan di sini.
Atribut ini digunakan untuk menandai metode pengujian.
[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
- Warisan
-
TestMethodAttribute
- Turunan
- Atribut
Keterangan
- Saat menggunakan atribut lain seperti DataRowAttribute atau DynamicDataAttribute, penggunaan TestMethodAttribute masih diperlukan.
- Metode pengujian harus:
- publik, atau jika DiscoverInternalsAttribute digunakan maka dapat bersifat internal.
- tidak statis
- tidak generik
- tidak abstrak
- jenis pengembalian adalah
void, , Taskatau ValueTask. Jikavoid, maka seharusnya tidakasync.
Konstruktor
| Nama | Deskripsi |
|---|---|
| TestMethodAttribute() |
Menginisialisasi instans baru dari kelas TestMethodAttribute. |
| TestMethodAttribute(String, Int32) |
Menginisialisasi instans baru dari kelas TestMethodAttribute. |
| TestMethodAttribute(String) |
Menginisialisasi instans baru dari kelas TestMethodAttribute. |
Properti
| Nama | Deskripsi |
|---|---|
| DeclaringFilePath |
Mendapatkan jalur file yang mendeklarasikan atribut . |
| DeclaringLineNumber |
Mendapatkan nomor baris dalam DeclaringFilePath yang mendeklarasikan atribut . |
| DisplayName |
Mendapatkan atau mengatur nama tampilan untuk pengujian. |
| UnfoldingStrategy |
Mendapatkan atau mengatur strategi untuk membuka pengujian berparameter. |
Metode
| Nama | Deskripsi |
|---|---|
| Execute(ITestMethod) |
Menjalankan metode pengujian. |
| ExecuteAsync(ITestMethod) |
Menjalankan metode pengujian. |