Dev2.PathOperations.Dev2FileSystemProvider.ListFoldersInDirectory C# (CSharp) Method

ListFoldersInDirectory() public method

Get folder listing for source
public ListFoldersInDirectory ( IActivityIOPath src ) : IList
src IActivityIOPath
return IList
        public IList<IActivityIOPath> ListFoldersInDirectory(IActivityIOPath src)
        {
            return ListDirectoriesAccordingToType(src, ReadTypes.Folders);
        }

Usage Example

        public void Dev2FileSystemProvider_ListFoldersInDirectory_Normal_AllFoldersInDirectoryReturned()
        {
            //------------Setup for test--------------------------
            var dev2FileSystemProvider = new Dev2FileSystemProvider();
            //string baseFolderDirectory = Path.GetTempPath() + @"\ListDirectoryTestFolder";
            string tmpFolderLocal = Path.GetTempPath() + @"\ListDirectoryTestFolderAllFoldersInDirectoryReturned\Folder1";
            string tmpFolderLocal2 = Path.GetTempPath() + @"\ListDirectoryTestFolderAllFoldersInDirectoryReturned\Folder2";
            string tmpFileLocal1 = Path.GetTempPath() + @"\ListDirectoryTestFolderAllFoldersInDirectoryReturned\File1.txt";
            string tmpFileLocal2 = Path.GetTempPath() + @"\ListDirectoryTestFolderAllFoldersInDirectoryReturned\File2.txt";
            CreateDirectory(tmpFolderLocal);
            CreateDirectory(tmpFolderLocal2);
            CreateLocalPath(tmpFileLocal1);
            CreateLocalPath(tmpFileLocal2);
            IActivityIOPath path = ActivityIOFactory.CreatePathFromString(Path.GetTempPath() + @"\ListDirectoryTestFolderAllFoldersInDirectoryReturned", "", "");

            //------------Execute Test---------------------------

            IList<IActivityIOPath> folderList = dev2FileSystemProvider.ListFoldersInDirectory(path);


            //------------Assert Results-------------------------

            Assert.AreEqual(2, folderList.Count);
            Assert.IsTrue(folderList[0].Path.EndsWith("Folder1"));
            Assert.IsTrue(folderList[1].Path.EndsWith("Folder2"));

            DeleteDirectory(Path.GetTempPath() + @"\ListDirectoryTestFolderAllFoldersInDirectoryReturned");
        }