Share via


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

验证指定的两个字符串是否不相等,根据指定的要求忽略大小写或不忽略大小写。 如果它们相等,则断言失败。

命名空间:  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 _
)
public static void AreNotEqual(
    string notExpected,
    string actual,
    bool ignoreCase
)
public:
static void AreNotEqual(
    String^ notExpected, 
    String^ actual, 
    bool ignoreCase
)
static member AreNotEqual : 
        notExpected:string * 
        actual:string * 
        ignoreCase:bool -> unit 
public static function AreNotEqual(
    notExpected : String, 
    actual : String, 
    ignoreCase : boolean
)

参数

  • notExpected
    类型:System.String
    要比较的第一个字符串。单元测试要求该字符串与 actual 不匹配。
  • actual
    类型:System.String
    要比较的第二个字符串。这是单元测试生成的字符串。
  • ignoreCase
    类型:System.Boolean
    一个布尔值,指示区分大小写或不区分大小写的比较。true 指示所进行的比较不区分大小写。

异常

异常 条件
AssertFailedException

notExpected 等于 actual。

备注

固定区域性用于该比较。

.NET Framework 安全性

请参见

参考

Assert 类

AreNotEqual 重载

Microsoft.VisualStudio.TestTools.UnitTesting 命名空间

其他资源

使用 Assert 类