bool IsFileExists(MockDirectory parent, Span <string> dirs) { if (dirs.Length == 0) { return(true); } if (dirs.Length == 1) { return(parent.ContainsFile(dirs[0])); } MockDirectory cur; if (!parent.TryGetDirectory(dirs[0], out cur)) { return(false); } return(IsFileExists(cur, dirs.Slice(1))); }