共用方式為


CollectionAssert.AreNotEquivalent 方法 (ICollection, ICollection, String)

確認兩個指定的集合不對等。 如果這些集合都對等,判斷提示就會失敗。 如果判斷提示失敗,便顯示一則訊息。

命名空間:  Microsoft.VisualStudio.TestTools.UnitTesting
組件:  Microsoft.VisualStudio.QualityTools.UnitTestFramework (在 Microsoft.VisualStudio.QualityTools.UnitTestFramework.dll 中)

語法

'宣告
Public Shared Sub AreNotEquivalent ( _
    expected As ICollection, _
    actual As ICollection, _
    message As String _
)
public static void AreNotEquivalent(
    ICollection expected,
    ICollection actual,
    string message
)
public:
static void AreNotEquivalent(
    ICollection^ expected, 
    ICollection^ actual, 
    String^ message
)
static member AreNotEquivalent : 
        expected:ICollection * 
        actual:ICollection * 
        message:string -> unit 
public static function AreNotEquivalent(
    expected : ICollection, 
    actual : ICollection, 
    message : String
)

參數

  • message
    型別:System.String
    要在判斷提示失敗時顯示的訊息。這項訊息會在單元測試結果中出現。

例外狀況

例外狀況 條件
AssertFailedException

這兩個集合含有相同的項目,包括每個項目重複出現的相同次數。

備註

如果兩個集合具有相同的項目且數量相同,但是順序不同,它們就是對等。 如果項目的值相等,它們就相等,但是如果它們參考相同的物件,則不相等。

.NET Framework 安全性

請參閱

參考

CollectionAssert 類別

AreNotEquivalent 多載

Microsoft.VisualStudio.TestTools.UnitTesting 命名空間

其他資源

使用 Assert 類別