Share via


Assert.EndsWith Method

Definition

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)

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

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