StringAssert.DoesNotMatch 方法 (String, Regex, String)

验证指定的字符串是否与正则表达式不匹配。 如果断言失败,将显示一则消息。

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

语法

声明
Public Shared Sub DoesNotMatch ( _
    value As String, _
    pattern As Regex, _
    message As String _
)
public static void DoesNotMatch(
    string value,
    Regex pattern,
    string message
)
public:
static void DoesNotMatch(
    String^ value, 
    Regex^ pattern, 
    String^ message
)
static member DoesNotMatch : 
        value:string * 
        pattern:Regex * 
        message:string -> unit 
public static function DoesNotMatch(
    value : String, 
    pattern : Regex, 
    message : String
)

参数

  • value
    类型:System.String
    不应与 pattern 匹配的字符串。
  • message
    类型:System.String
    断言失败时显示的消息。在单元测试结果中可以看到此消息。

异常

异常 条件
AssertFailedException

value 与 pattern匹配。

备注

如果字符串与表达式匹配,则断言失败。

.NET Framework 安全性

请参见

参考

StringAssert 类

DoesNotMatch 重载

Microsoft.VisualStudio.TestTools.UnitTesting 命名空间