HOW TO:將輸出屬性加入至資料產生器
輸出屬性是自訂產生器的屬性,自訂產生器可用來將測試資料填入資料表的資料行。 您可以使用 OutputAttribute 屬性 (Attribute) 裝飾公用屬性 (Property),以此方式建立輸出屬性 (Property)。
若要建立輸出屬性
使用 Output 屬性 (Attribute) 裝飾產生器的公用屬性 (Property),如下列範例所示。 Name 和 Description 的值會出現在介面上,提供資訊給使用者,不過這些是選擇項。 如果您省略,介面則會顯示屬性名稱。
<Output(Description:="This is the description", Name:="This is the descriptive name")> _ Public Property MyProperty() As Integer Get Return myPropertyValue End Get End Property
[Output(Description=" This is the description ", Name=" This is the descriptive name ")] public int MyProperty { get { return myPropertyValue; } }