CollectionAssert.AllItemsAreNotNull 方法 (ICollection, String, array<Object )
確認指定之集合中的所有項目都不是 nullnull 參考 (即 Visual Basic 中的 Nothing)。如果有任何項目是 nullnull 參考 (即 Visual Basic 中的 Nothing),判斷提示就會失敗。如果判斷提示失敗,便顯示一則訊息,並套用指定的格式。
命名空間: Microsoft.VisualStudio.TestTools.UnitTesting
組件: Microsoft.VisualStudio.QualityTools.UnitTestFramework (在 Microsoft.VisualStudio.QualityTools.UnitTestFramework.dll 中)
語法
'宣告
Public Shared Sub AllItemsAreNotNull ( _
collection As ICollection, _
message As String, _
ParamArray parameters As Object() _
)
public static void AllItemsAreNotNull(
ICollection collection,
string message,
params Object[] parameters
)
public:
static void AllItemsAreNotNull(
ICollection^ collection,
String^ message,
... array<Object^>^ parameters
)
static member AllItemsAreNotNull :
collection:ICollection *
message:string *
parameters:Object[] -> unit
public static function AllItemsAreNotNull(
collection : ICollection,
message : String,
... parameters : Object[]
)
參數
- collection
型別:System.Collections.ICollection
要在其中搜尋 nullnull 參考 (即 Visual Basic 中的 Nothing) 項目的集合。
- message
型別:System.String
要在判斷提示失敗時顯示的訊息。這項訊息會在單元測試結果中出現。
- parameters
型別:array<System.Object[]
在格式化 message 時所要使用的參數陣列。
例外狀況
例外狀況 | 條件 |
---|---|
AssertFailedException | nullnull 參考 (即 Visual Basic 中的 Nothing) 的項目在 collection 中。 |
.NET Framework 安全性
- 完全信任立即呼叫者。這個成員無法供部分信任的程式碼使用。如需詳細資訊,請參閱從部分受信任程式碼使用程式庫。
請參閱
參考
Microsoft.VisualStudio.TestTools.UnitTesting 命名空間