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)); } }
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); }
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"))); }
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); }
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); }
public void InitializeAfterDeserialization(StreamingContext context) { Root = new WindowsDrive(PathExt.GetDriveLetter(CurrentPlace.FullName)); LoadDirectory(CurrentPlace.FullName); }
public MemoryFileSystemProvider() { Root = new FileSystemRoot(); }
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(); }
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; }