public void DirectoryConstructorWithoutParametersTest() { //Arrange //Act Directory target = new Directory(); //Assert Assert.IsNotNull(target.Children); }
public void DirectoryConstructorWithDirectoryInfoTest() { //Arrange DirectoryInfo info = new DirectoryInfo((string)(TestContext.Properties[ValidFolderPathKey])); //Act Directory target = new Directory(info.Name, info.FullName, null); //Assert Assert.IsNotNull(target.Children); Assert.AreEqual(target.Name, info.Name); Assert.AreEqual(target.FullPath, info.FullName); }
public void Open(String name) { if (_current == null) { _current = (from di in _fileStruture where di.Name.Equals(name, StringComparison.CurrentCultureIgnoreCase) select di).FirstOrDefault(); if (_current == null) throw new DirectoryNotFoundException("Invalid path"); CurrentPath = _current.FullPath; return; } Directory next = _current.Children.Where(dir => dir.Name.Equals(name)).FirstOrDefault() as Directory; if (next == null) throw new DirectoryNotFoundException("Invalid directory"); _current = next; CurrentPath = next.FullPath; }
public void Up() { if(_current == null){ return; } _current = _current.Parent; CurrentPath = _current != null ? _current.FullPath : String.Empty; }
public File(String name, String fullPath, Directory parent) : base(name, fullPath) { Parent = parent; }