-
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathParenthesisConstraint.cs
More file actions
30 lines (23 loc) · 770 Bytes
/
ParenthesisConstraint.cs
File metadata and controls
30 lines (23 loc) · 770 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
namespace NetEvolve.FluentValue.Constraints;
using System.Text;
using NetEvolve.FluentValue;
internal sealed class ParenthesisConstraint : ConstraintBase
{
private readonly ConstraintBase _constraint;
internal ParenthesisConstraint(IConstraint constraint)
{
ArgumentNullException.ThrowIfNull(constraint);
_constraint = (ConstraintBase)constraint;
}
public override bool IsSatisfiedBy(object? value)
{
ArgumentNullException.ThrowIfNull(_constraint);
return _constraint.IsSatisfiedBy(value);
}
public override void SetDescription(StringBuilder builder)
{
_ = builder.Append(" (");
_constraint.SetDescription(builder);
_ = builder.Replace("( ", "(").Append(')');
}
}