public void ShouldFindTheMostSpecificMatch() { var resolver = new MountPointResolver(); var mounts = new List<MountPoint>(); mounts.Add(new MountPoint { Handler = null, VirtualPath = "/dir" }); mounts.Add(new MountPoint { Handler = null, VirtualPath = "/dir/subdir" }); mounts.Add(new MountPoint { Handler = null, VirtualPath = "/dir/subdir/subsub" }); MountPoint mount = resolver.Resolve(mounts, "/dir/subdir"); Assert.IsNotNull(mount); Assert.AreEqual("/dir/subdir", mount.VirtualPath); mount = resolver.Resolve(mounts, "/dir/subdir/file.ext"); Assert.IsNotNull(mount); Assert.AreEqual("/dir/subdir", mount.VirtualPath); }
public void ShouldReturnNullWhenNotFound() { var resolver = new MountPointResolver(); var mounts = new List<MountPoint>(); mounts.Add(new MountPoint { Handler = null, VirtualPath = "/dir" }); MountPoint mount = resolver.Resolve(mounts, "/non-existing-path"); Assert.IsNull(mount); }