EndsWithConstraint
EndsWithConstraint can test whether a string ends
with an expected substring.
namespace NUnit.Framework.Constraints
{
public class EndsWithConstraint : StringConstraint
{
public EndsWithConstraint(string expected)
: base(expected)
{
descriptionText = "String ending with";
}
protected override bool Matches(string actual)
{
if (caseInsensitive)
return actual?.ToLower().EndsWith(expected.ToLower()) ?? false;
return actual?.EndsWith(expected) ?? false;
}
}
}