Esempio n. 1
0
        MockFile GetFileOrThrow(MockDirectory parent, string name)
        {
            MockFile cur;

            if (!parent.TryGetFile(name, out cur))
            {
                ThrowCommonException();
            }
            return(cur);
        }
Esempio n. 2
0
 byte[] ReadAllBytes(MockDirectory parent, Span <string> parts)
 {
     if (parts.Length == 0)
     {
         ThrowCommonException();
     }
     if (parts.Length == 1)
     {
         if (parent.TryGetFile(parts[0], out var file))
         {
             return(file.Data);
         }
         ThrowCommonException();
     }
     return(ReadAllBytes(GetDirectoryOrThrow(parent, parts[0]), parts.Slice(1)));
 }