예제 #1
0
        internal FakeFileSystem([NotNull] DirectoryEntry root, [NotNull] WaitIndicator copyWaitIndicator)
        {
            Guard.NotNull(root, nameof(root));
            this.root = root;

            File      = new FileOperationLocker <FakeFile>(this, new FakeFile(root, this));
            Directory = new DirectoryOperationLocker <FakeDirectory>(this, new FakeDirectory(root, this));
            CurrentDirectoryManager = new CurrentDirectoryManager(root);
            relativePathConverter   = new RelativePathConverter(CurrentDirectoryManager);
            CopyWaitIndicator       = copyWaitIndicator;
        }
예제 #2
0
        public IDirectoryInfo CreateSubdirectory(string path)
        {
            Guard.NotNull(path, nameof(path));

            AssertPathIsNotEmpty(path);
            AssertPathIsRelative(path);

            AbsolutePath completePath =
                path.Trim().Length == 0 ? AbsolutePath : RelativePathConverter.Combine(AbsolutePath, path);

            if (!PathStartsWith(completePath, AbsolutePath))
            {
                throw ErrorFactory.System.DirectoryIsNotASubdirectory(path, AbsolutePath.GetText());
            }

            return(Owner.Directory.CreateDirectory(completePath.GetText()));
        }
예제 #3
0
        internal FakeFileSystem([NotNull] VolumeContainer container, [NotNull] string tempDirectory,
                                [NotNull] WaitIndicator copyWaitIndicator)
        {
            Guard.NotNull(container, nameof(container));
            Guard.NotNull(copyWaitIndicator, nameof(copyWaitIndicator));

            this.container    = container;
            TempDirectory     = tempDirectory;
            CopyWaitIndicator = copyWaitIndicator;

            File      = new FileOperationLocker <FakeFile>(container.FileSystemLock, new FakeFile(container, this));
            Directory = new DirectoryOperationLocker <FakeDirectory>(container.FileSystemLock, new FakeDirectory(container, this));
            Drive     = new DriveOperationLocker <FakeDrive>(container.FileSystemLock, new FakeDrive(container, this));
            Path      = new PathOperationLocker <FakePath>(container.FileSystemLock, new FakePath(container, this));
            CurrentDirectoryManager = new CurrentDirectoryManager(container);
            relativePathConverter   = new RelativePathConverter(CurrentDirectoryManager);
            RandomNumberGenerator   = CreateRandomNumberGenerator(container.SystemClock);
        }