语言

Assert.EndsWith 方法

定义

重载

名称 说明
EndsWith(String, String, String)

测试指定的字符串是否以指定的子字符串结尾,如果测试字符串不以子字符串结尾,则引发异常。

EndsWith(String, String, StringComparison, String)

测试指定的字符串是否以指定的子字符串结尾,如果测试字符串不以子字符串结尾,则引发异常。

EndsWith(String, String, String, String, String)

测试指定的字符串是否以指定的后缀结尾,如果测试字符串不以后缀结尾,则引发异常。

EndsWith(String, String, StringComparison, String, String, String)

测试指定的字符串是否以指定的后缀结尾,如果测试字符串不以后缀结尾,则引发异常。

EndsWith(String, String, String)

Source:
Assert.EndsWith.cs
Source:
Assert.EndsWith.cs

测试指定的字符串是否以指定的子字符串结尾,如果测试字符串不以子字符串结尾,则引发异常。

public static void EndsWith(string? substring, string? value, string message = "");
static member EndsWith : string * string * string -> unit
Public Shared Sub EndsWith (substring As String, value As String, Optional message As String = "")

参数

substring
String

字符串应为后缀 value。

value
String

应以 . 结尾的 substring字符串。

message
String

当异常中未结束value时substring要包含在异常中的消息。 消息显示在测试结果中。

例外

value 为 null 或 substring 为 null,或者 value 不以 . 结尾 substring。

适用于

EndsWith(String, String, StringComparison, String)

Source:
Assert.EndsWith.cs
Source:
Assert.EndsWith.cs

测试指定的字符串是否以指定的子字符串结尾,如果测试字符串不以子字符串结尾,则引发异常。

public static void EndsWith(string? substring, string? value, StringComparison comparisonType, string message = "");
static member EndsWith : string * string * StringComparison * string -> unit
Public Shared Sub EndsWith (substring As String, value As String, comparisonType As StringComparison, Optional message As String = "")

参数

substring
String

字符串应为后缀 value。

value
String

应以 . 结尾的 substring字符串。

comparisonType
StringComparison

比较字符串 comparisonType的比较方法。

message
String

当异常中未结束value时substring要包含在异常中的消息。 消息显示在测试结果中。

例外

value 为 null 或 substring 为 null,或者 value 不以 substring. 开头。

适用于

EndsWith(String, String, String, String, String)

Source:
Assert.EndsWith.cs
Source:
Assert.EndsWith.cs
Source:
Assert.EndsWith.cs
Source:
Assert.EndsWith.cs

测试指定的字符串是否以指定的后缀结尾,如果测试字符串不以后缀结尾,则引发异常。

public static void EndsWith(string? expectedSuffix, string? value, string? message = "", string expectedSuffixExpression = "", string valueExpression = "");
static member EndsWith : string * string * string * string * string -> unit
Public Shared Sub EndsWith (expectedSuffix As String, value As String, Optional message As String = "", Optional expectedSuffixExpression As String = "", Optional valueExpression As String = "")

参数

expectedSuffix
String

字符串应为后缀 value。

value
String

应以 . 结尾的 expectedSuffix字符串。

message
String

当异常中未结束value时expectedSuffix要包含在异常中的消息。 消息显示在测试结果中。

expectedSuffixExpression
String

由编译器通过调用方参数表达式提供的 expectedSuffix 的语法表达式。 用户不应传递此参数的值。

valueExpression
String

编译器通过调用方参数表达式提供的值的语法表达式。 用户不应传递此参数的值。

例外

value 为 null 或 expectedSuffix 为 null,或者 value 不以 . 结尾 expectedSuffix。

适用于

EndsWith(String, String, StringComparison, String, String, String)

Source:
Assert.EndsWith.cs
Source:
Assert.EndsWith.cs
Source:
Assert.EndsWith.cs
Source:
Assert.EndsWith.cs

测试指定的字符串是否以指定的后缀结尾,如果测试字符串不以后缀结尾,则引发异常。

public static void EndsWith(string? expectedSuffix, string? value, StringComparison comparisonType, string? message = "", string expectedSuffixExpression = "", string valueExpression = "");
static member EndsWith : string * string * StringComparison * string * string * string -> unit
Public Shared Sub EndsWith (expectedSuffix As String, value As String, comparisonType As StringComparison, Optional message As String = "", Optional expectedSuffixExpression As String = "", Optional valueExpression As String = "")

参数

expectedSuffix
String

字符串应为后缀 value。

value
String

应以 . 结尾的 expectedSuffix字符串。

comparisonType
StringComparison

比较字符串 comparisonType的比较方法。

message
String

当异常中未结束value时expectedSuffix要包含在异常中的消息。 消息显示在测试结果中。

expectedSuffixExpression
String

由编译器通过调用方参数表达式提供的 expectedSuffix 的语法表达式。 用户不应传递此参数的值。

valueExpression
String

编译器通过调用方参数表达式提供的值的语法表达式。 用户不应传递此参数的值。

例外

value 为 null 或 expectedSuffix 为 null,或者 value 不以 . 结尾 expectedSuffix。

适用于