共用方式為


CollectionAssert.AllItemsAreNotNull 方法 (ICollection, String)

確認指定之集合中的所有項目都不是 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 _
)
public static void AllItemsAreNotNull(
    ICollection collection,
    string message
)
public:
static void AllItemsAreNotNull(
    ICollection^ collection, 
    String^ message
)
static member AllItemsAreNotNull : 
        collection:ICollection * 
        message:string -> unit
public static function AllItemsAreNotNull(
    collection : ICollection, 
    message : String
)

參數

  • collection
    類型:ICollection

    要在其中搜尋 nullnull 參考 (即 Visual Basic 中的 Nothing) 項目的集合。

  • message
    類型:String

    要在判斷提示失敗時顯示的訊息。 這項訊息會在單元測試結果中出現。

例外狀況

例外狀況 條件
AssertFailedException

nullnull 參考 (即 Visual Basic 中的 Nothing) 的項目在 collection 中。

.NET Framework 安全性

請參閱

參考

CollectionAssert 類別

AllItemsAreNotNull 多載

Microsoft.VisualStudio.TestTools.UnitTesting 命名空間

其他資源

使用 Assert 類別