AttributeOperator
Operator that tests for the presence of a particular attribute
on a type and optionally applies further tests to the attribute.
using System;
using System.Runtime.CompilerServices;
namespace NUnit.Framework.Constraints
{
[System.Runtime.CompilerServices.NullableContext(1)]
[System.Runtime.CompilerServices.Nullable(0)]
public class AttributeOperator : SelfResolvingOperator
{
private readonly Type _type;
public AttributeOperator(Type type)
{
_type = type;
left_precedence = (right_precedence = 1);
}
public override void Reduce(ConstraintBuilder.ConstraintStack stack)
{
if (base.RightContext == null || base.RightContext is BinaryOperator)
stack.Push(new AttributeExistsConstraint(_type));
else
stack.Push(new AttributeConstraint(_type, stack.Pop()));
}
}
}