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

SubPathConstraint

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