LessThanOrEqualConstraint
Tests whether a value is less than or equal to the value supplied to its constructor
using System.Runtime.CompilerServices;
namespace NUnit.Framework.Constraints
{
[NullableContext(1)]
[Nullable(0)]
public class LessThanOrEqualConstraint : ComparisonConstraint
{
public LessThanOrEqualConstraint(object expected)
: base(expected, "less than or equal to ")
{
}
protected override bool PerformComparison(ComparisonAdapter comparer, object actual, object expected, Tolerance tolerance)
{
return comparer.Compare(actual, tolerance.ApplyToValue(expected).UpperBound) <= 0;
}
}
}