OrConstraint
OrConstraint succeeds if either member succeeds
using System.Runtime.CompilerServices;
namespace NUnit.Framework.Constraints
{
[System.Runtime.CompilerServices.NullableContext(1)]
[System.Runtime.CompilerServices.Nullable(0)]
public class OrConstraint : BinaryConstraint
{
public override string Description => Left.Description + " or " + Right.Description;
public OrConstraint(IConstraint left, IConstraint right)
: base(left, right)
{
}
public override ConstraintResult ApplyTo<[System.Runtime.CompilerServices.Nullable(2)] TActual>(TActual actual)
{
bool isSuccess = Left.ApplyTo(actual).IsSuccess || Right.ApplyTo(actual).IsSuccess;
return new ConstraintResult(this, actual, isSuccess);
}
}
}