SamePathOrUnderConstraint
SamePathOrUnderConstraint tests that one path is under another
using System.Runtime.CompilerServices;
namespace NUnit.Framework.Constraints
{
[System.Runtime.CompilerServices.NullableContext(1)]
[System.Runtime.CompilerServices.Nullable(0)]
public class SamePathOrUnderConstraint : PathConstraint
{
public override string Description => "Path under or matching " + MsgUtils.FormatValue(expected);
public SamePathOrUnderConstraint(string expected)
: base(expected)
{
}
[System.Runtime.CompilerServices.NullableContext(2)]
protected override bool Matches(string actual)
{
if (actual == null)
return false;
string text = Canonicalize(expected);
string text2 = Canonicalize(actual);
if (!string.Equals(text, text2, DetermineComparisonType()))
return IsSubPath(text, text2);
return true;
}
}
}