Assert.EndsWith Method
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Overloads
| EndsWith(String, String, String) |
Tests whether the specified string ends with the specified substring and throws an exception if the test string does not end with the substring. |
| EndsWith(String, String, StringComparison, String) |
Tests whether the specified string ends with the specified substring and throws an exception if the test string does not end with the substring. |
| EndsWith(String, String, String, String, String) |
Tests whether the specified string ends with the specified suffix and throws an exception if the test string does not end with the suffix. |
| EndsWith(String, String, StringComparison, String, String, String) |
Tests whether the specified string ends with the specified suffix and throws an exception if the test string does not end with the suffix. |
EndsWith(String, String, String)
- Source:
- Assert.EndsWith.cs
- Source:
- Assert.EndsWith.cs
Tests whether the specified string ends with the specified substring and throws an exception if the test string does not end with the substring.
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 = "")
Parameters
- substring
- String
The string expected to be a suffix of value.
- value
- String
The string that is expected to end with substring.
- message
- String
The message to include in the exception when value
does not end with substring. The message is
shown in test results.
Exceptions
value is null, or substring is null,
or value does not end with substring.
Applies to
EndsWith(String, String, StringComparison, String)
- Source:
- Assert.EndsWith.cs
- Source:
- Assert.EndsWith.cs
Tests whether the specified string ends with the specified substring and throws an exception if the test string does not end with the substring.
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 = "")
Parameters
- substring
- String
The string expected to be a suffix of value.
- value
- String
The string that is expected to end with substring.
- comparisonType
- StringComparison
The comparison method to compare strings comparisonType.
- message
- String
The message to include in the exception when value
does not end with substring. The message is
shown in test results.
Exceptions
value is null, or substring is null,
or value does not start with substring.
Applies to
EndsWith(String, String, String, String, String)
- Source:
- Assert.EndsWith.cs
Tests whether the specified string ends with the specified suffix and throws an exception if the test string does not end with the suffix.
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 = "")
Parameters
- expectedSuffix
- String
The string expected to be a suffix of value.
- value
- String
The string that is expected to end with expectedSuffix.
- message
- String
The message to include in the exception when value
does not end with expectedSuffix. The message is
shown in test results.
- expectedSuffixExpression
- String
The syntactic expression of expectedSuffix as given by the compiler via caller argument expression. Users shouldn't pass a value for this parameter.
- valueExpression
- String
The syntactic expression of value as given by the compiler via caller argument expression. Users shouldn't pass a value for this parameter.
Exceptions
value is null, or expectedSuffix is null,
or value does not start with expectedSuffix.
Applies to
EndsWith(String, String, StringComparison, String, String, String)
- Source:
- Assert.EndsWith.cs
Tests whether the specified string ends with the specified suffix and throws an exception if the test string does not end with the suffix.
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 = "")
Parameters
- expectedSuffix
- String
The string expected to be a suffix of value.
- value
- String
The string that is expected to end with expectedSuffix.
- comparisonType
- StringComparison
The comparison method to compare strings comparisonType.
- message
- String
The message to include in the exception when value
does not end with expectedSuffix. The message is
shown in test results.
- expectedSuffixExpression
- String
The syntactic expression of expectedSuffix as given by the compiler via caller argument expression. Users shouldn't pass a value for this parameter.
- valueExpression
- String
The syntactic expression of value as given by the compiler via caller argument expression. Users shouldn't pass a value for this parameter.
Exceptions
value is null, or expectedSuffix is null,
or value does not start with expectedSuffix.