public void Setup()
        {
            _fileSystem = new MemoryFileSystem().WithDrives("c:", "d:");

            _emptyDrive = _fileSystem.DriveDescribing("d:");
            _nonExistingDrive = _fileSystem.DriveDescribing("e:");
            _nonExistingDirectory = _fileSystem.DirectoryDescribing(@"c:\nonExistingDirectory");

            var populate = new FileSystemBuilder(_fileSystem);
            _emptyDirectory = populate.WithDir(@"c:\emptyDirectory");
            _nonEmptyDirectory = populate.WithDir(@"c:\crowdedDirectory");
            populate.WithDir(@"c:\crowdedDirectory\first");
            populate.WithDir(@"c:\crowdedDirectory\first\first");
            populate.WithDir(@"c:\crowdedDirectory\second");
        }
Example #2
0
        public void PopulateFileSystem()
        {
            FileSystem = CreateFileSystem();

            _tempDir = FileSystem.DirectoryDescribingTemporaryDirectory() + RelativeDirectory.FromString("PopulatedFileSystem");

            // Note: Must create file system from leaf to root since modifications to an item might modify the parent as well
            var populateFileSystem = new FileSystemBuilder(FileSystem, _tempDir);

            ExistingFile = populateFileSystem
                .WithFile(@"path\to\file.txt")
                .Containing(ExistingFileContents)
                .LastModifiedAt(ExistingFileLastWriteTime)
                .LastAccessedAt(ExistingFileLastAccessTime)
                .CreatedAt(ExistingFileCreationTime);
            ExistingEmptyFile = populateFileSystem
                .WithFile(@"path\to\file2.txt");
            NonExistingFile = FileSystem.FileDescribing(InTemp(@"path\to\another.txt"));

            ExistingLeafDirectory = populateFileSystem
                .WithDir(@"path\to")
                .LastModifiedAt(ExistingLeafDirectoryLastWriteTime)
                .LastAccessedAt(ExistingLeafDirectoryLastAccessTime)
                .CreatedAt(ExistingLeafDirectoryCreationTime);
            ParentOfExistingLeafDirectory = populateFileSystem
                .WithDir(@"path")
                .LastModifiedAt(ParentOfExistingLeafDirectoryLastWriteTime)
                .LastAccessedAt(ParentOfExistingLeafDirectoryLastAccessTime)
                .CreatedAt(ParentOfExistingLeafDirectoryCreationTime);
            ExistingEmptyDirectory = populateFileSystem
                .WithDir(@"my\path");
            ExistingEmptyDirectory2 = populateFileSystem
                .WithDir(@"my\other");
            NonExistingDirectory = FileSystem.DirectoryDescribing(InTemp(@"another\path\to"));

            NonExistingDrive = FileSystem.DriveDescribing("z:");
        }