Example #1
0
        MockDirectory GetDirectoryOrThrow(MockDirectory parent, string name)
        {
            MockDirectory cur;

            if (!parent.TryGetDirectory(name, out cur))
            {
                ThrowCommonException();
            }
            return(cur);
        }
Example #2
0
        bool IsDirectoryExists(MockDirectory parent, Span <string> dirs)
        {
            if (dirs.Length == 0)
            {
                return(true);
            }
            MockDirectory cur;

            if (!parent.TryGetDirectory(dirs[0], out cur))
            {
                return(false);
            }
            return(IsDirectoryExists(cur, dirs.Slice(1)));
        }
Example #3
0
        void CreateDirectory(MockDirectory parent, Span <string> dirs)
        {
            if (dirs.Length == 0)
            {
                return;
            }
            MockDirectory cur;

            if (!parent.TryGetDirectory(dirs[0], out cur))
            {
                cur = new MockDirectory();
                parent.AddDirectory(dirs[0], cur);
            }
            CreateDirectory(cur, dirs.Slice(1));
        }