共用方式為


StringAssert.DoesNotMatch 方法 (String, Regex)

確認指定的字串不符合規則運算式。

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

語法

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

參數

  • value
    型別:System.String
    預期不會符合 pattern 的字串。

例外狀況

例外狀況 條件
AssertFailedException

value 符合 pattern。

備註

如果這個字串符合運算式,判斷提示就會失敗。

.NET Framework 安全性

請參閱

參考

StringAssert 類別

DoesNotMatch 多載

Microsoft.VisualStudio.TestTools.UnitTesting 命名空間