Class EndsWithConstraint
EndsWithConstraint can test whether a string ends with an expected substring.
Inherited Members
Namespace: NUnit.Framework.Constraints
Assembly: nunit.framework.dll
Syntax
public class EndsWithConstraint : StringConstraint, IConstraint, IResolveConstraint
Constructors
View SourceEndsWithConstraint(string)
Initializes a new instance of the EndsWithConstraint class.
Declaration
public EndsWithConstraint(string expected)
Parameters
| Type | Name | Description |
|---|---|---|
| string | expected | The expected string |
Methods
View SourceMatches(string?)
Determines whether the actual string value ends with the expected substring.
Declaration
protected override bool Matches(string? actual)
Parameters
| Type | Name | Description |
|---|---|---|
| string | actual | The string value to test. |
Returns
| Type | Description |
|---|---|
| bool |
Overrides
View SourceMatches(string?, CultureInfo)
Determines whether the actual string value ends with the expected substring,
using the specified CultureInfo and case sensitivity specified by the constraint.
If cultureInfo is not null, the comparison uses culture-specific rules;
otherwise, it falls back to the default string comparison logic.
Declaration
protected override bool Matches(string? actual, CultureInfo cultureInfo)
Parameters
| Type | Name | Description |
|---|---|---|
| string | actual | The string value to test. |
| CultureInfo | cultureInfo | The culture information to use for the comparison. |
Returns
| Type | Description |
|---|---|
| bool |
Overrides
View SourceMatches(string?, StringComparison)
Determines whether the actual string value ends with the expected substring, using the specified string comparison.
Declaration
protected override bool Matches(string? actual, StringComparison stringComparison)
Parameters
| Type | Name | Description |
|---|---|---|
| string | actual | The string value to test. |
| StringComparison | stringComparison | The string comparison to use. |
Returns
| Type | Description |
|---|---|
| bool |