Share via


Assert.AreNotEqual 方法 (String, String, Boolean, CultureInfo, String)

使用所指定的区域性信息验证指定的两个字符串是否不相等,根据指定的要求忽略大小写或不忽略大小写。 如果它们相等,则断言失败。 如果断言失败,将显示一则消息。

命名空间:  Microsoft.VisualStudio.TestTools.UnitTesting
程序集:  Microsoft.VisualStudio.QualityTools.UnitTestFramework(在 Microsoft.VisualStudio.QualityTools.UnitTestFramework.dll 中)

语法

声明
Public Shared Sub AreNotEqual ( _
    notExpected As String, _
    actual As String, _
    ignoreCase As Boolean, _
    culture As CultureInfo, _
    message As String _
)
public static void AreNotEqual(
    string notExpected,
    string actual,
    bool ignoreCase,
    CultureInfo culture,
    string message
)
public:
static void AreNotEqual(
    String^ notExpected, 
    String^ actual, 
    bool ignoreCase, 
    CultureInfo^ culture, 
    String^ message
)
static member AreNotEqual : 
        notExpected:string * 
        actual:string * 
        ignoreCase:bool * 
        culture:CultureInfo * 
        message:string -> unit 
public static function AreNotEqual(
    notExpected : String, 
    actual : String, 
    ignoreCase : boolean, 
    culture : CultureInfo, 
    message : String
)

参数

  • notExpected
    类型:System.String
    要比较的第一个字符串。单元测试要求该字符串与 actual 不匹配。
  • actual
    类型:System.String
    要比较的第二个字符串。这是单元测试生成的字符串。
  • ignoreCase
    类型:System.Boolean
    一个布尔值,指示区分大小写或不区分大小写的比较。true 指示所进行的比较不区分大小写。
  • message
    类型:System.String
    断言失败时显示的消息。在单元测试结果中可以看到此消息。

异常

异常 条件
AssertFailedException

notExpected 等于 actual。

.NET Framework 安全性

请参见

参考

Assert 类

AreNotEqual 重载

Microsoft.VisualStudio.TestTools.UnitTesting 命名空间

其他资源

使用 Assert 类