<PackageReference Include="NUnit" Version="4.3.1" />

SubPathConstraint

SubPathConstraint tests that the actual path is under the expected path
using System.Runtime.CompilerServices; namespace NUnit.Framework.Constraints { [NullableContext(1)] [Nullable(0)] public class SubPathConstraint : PathConstraint { public override string Description => "Subpath of " + MsgUtils.FormatValue(expected); public SubPathConstraint(string expected) : base(expected) { } [NullableContext(2)] protected override bool Matches(string actual) { if (actual != null) return IsSubPath(Canonicalize(expected), Canonicalize(actual)); return false; } } }