PropOperator
Operator used to test for the presence of a named Property
on an object and optionally apply further tests to the
value of that property.
using System.Runtime.CompilerServices;
namespace NUnit.Framework.Constraints
{
[System.Runtime.CompilerServices.NullableContext(1)]
[System.Runtime.CompilerServices.Nullable(0)]
public class PropOperator : SelfResolvingOperator
{
private readonly string _name;
public string Name => _name;
public PropOperator(string name)
{
_name = name;
left_precedence = (right_precedence = 1);
}
public override void Reduce(ConstraintBuilder.ConstraintStack stack)
{
if (base.RightContext == null || base.RightContext is BinaryOperator)
stack.Push(new PropertyExistsConstraint(_name));
else
stack.Push(new PropertyConstraint(_name, stack.Pop()));
}
}
}