Example #1
0
 public FolderPair(int parentID, string parentPath, string path, FileSystemRoot folder)
 {
     ParentID   = parentID;
     Path       = path;
     ParentPath = parentPath;
     Folder     = folder;
 }
        public void Checking_File_With_Folder_Name_Should_Report_Unavailable_Resource()
        {
            var folders = FileSystemRoot.GetFolders();

            CollectionAssert.IsNotEmpty(folders);

            foreach (var folder in folders)
            {
                Assert.IsFalse(FileSystem.IsFileAvailable(folder.MetaData.FullName));
            }
        }
        public void Checking_Existing_Folder_Should_Work()
        {
            var folders = FileSystemRoot.GetFolders();

            CollectionAssert.IsNotEmpty(folders);

            foreach (var folder in folders)
            {
                Assert.IsTrue(FileSystem.IsFolderAvailable(folder.MetaData.FullName));
            }
        }
Example #4
0
        internal static Directory CreateDirectory(FileSystemRoot folder, IFileSystem fs, IRepository <ContentItem> persister, IDependencyInjector dependencyInjector)
        {
            var dd     = fs.GetDirectoryOrVirtual(folder.Path);
            var parent = persister.Get(folder.GetParentID());

            var dir = Directory.New(dd, parent, dependencyInjector);

            dir.Name  = folder.GetName();
            dir.Title = folder.Title ?? dir.Name;

            Apply(folder.Readers, dir);
            Apply(folder.Writers, dir);

            return(dir);
        }
Example #5
0
        public void ShouldCorrectlyResolveAbsolutePathsOfReferencedProjects()
        {
            //GIVEN
            var projectFilePath = AbsoluteFilePath.Value(
                $"{FileSystemRoot.PlatformSpecificValue()}{Path.DirectorySeparatorChar}A{Path.DirectorySeparatorChar}A.csproj");
            var referenceToProjectB = "..\\B\\B.csproj";
            var dataAccess          = XmlProjectDataAccess.From(projectFilePath,
                                                                XmlProjectWith(projectFilePath, referenceToProjectB)
                                                                );

            //WHEN
            var dto = dataAccess.BuildCsharpProjectDto();

            //THEN
            dto.ReferencedProjectIds.Should().HaveCount(1);
            dto.ReferencedProjectIds.Should().Equal(
                ImmutableList <ProjectId> .Empty.Add(
                    new ProjectId($"{FileSystemRoot.PlatformSpecificValue()}{Path.DirectorySeparatorChar}B{Path.DirectorySeparatorChar}B.csproj")));
        }
Example #6
0
            public MockFileSystemModel(string temporaryFolder,
                                       FileSystemRoot files = null,
                                       string fileSystemMockWorkingDirectory = null)
            {
                if (fileSystemMockWorkingDirectory == null)
                {
                    if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
                    {
                        fileSystemMockWorkingDirectory = @"C:\";
                    }
                    else
                    {
                        fileSystemMockWorkingDirectory = "/";
                    }
                }

                WorkingDirectory = fileSystemMockWorkingDirectory;
                TemporaryFolder  =
                    temporaryFolder ?? Path.Combine(fileSystemMockWorkingDirectory, "mockTemporaryFolder");
                Files = files ?? new FileSystemRoot();
                CreateDirectory(WorkingDirectory);
            }
Example #7
0
        public override void LoadDirectory(string path)
        {
            Items.Clear();
            DirectoryInfo di = new DirectoryInfo(path);
            FileSystemInfo[] infos = di.GetFileSystemInfos();
            int addUp = Convert.ToInt32(!PathExt.IsDriveRoot(path));
            if (addUp == 1)
                Items.Add(new MoveUpObject());
            foreach (FileSystemInfo info in infos)
                if ((info.Attributes & FileAttributes.Hidden) != FileAttributes.Hidden)//OPTIONS: Show hidden files
                    Items.Add(new WindowsFile(info));

            CurrentPlace = new WindowsFile(di);

            //check if drive has changed
            if (Root == null || Path.GetPathRoot(FullPath) != Root.Path)
                Root = new WindowsDrive(DriveLetter);
        }
Example #8
0
 public void InitializeAfterDeserialization(StreamingContext context)
 {
     Root = new WindowsDrive(PathExt.GetDriveLetter(CurrentPlace.FullName));
     LoadDirectory(CurrentPlace.FullName);
 }
Example #9
0
 public MemoryFileSystemProvider()
 {
     Root = new FileSystemRoot();
 }
Example #10
0
 public string PathCombine(string path1, string path2)
 {
     return(FileSystemRoot.PathCombine(path1, path2));
 }
 public void Querying_Parent_Of_Root_Folder_Should_Not_Work()
 {
     var folder = FileSystemRoot.GetParentFolder();
 }
Example #12
0
        internal static Directory CreateDirectory(FileSystemRoot folder, IFileSystem fs, IRepository<ContentItem> persister, IDependencyInjector dependencyInjector)
        {
            var dd = fs.GetDirectoryOrVirtual(folder.Path);
            var parent = persister.Get(folder.GetParentID());

            var dir = Directory.New(dd, parent, dependencyInjector);
            dir.Name = folder.GetName();
            dir.Title = folder.Title ?? dir.Name;
            dir.UrlPrefix = folder.UrlPrefix;

            Apply(folder.Readers, dir);
            Apply(folder.Writers, dir);

            return dir;
        }