Example #1
0
        public void MoveAllImagesToFlatOrder_WhenDirectoryHasOnlyFiles_ThenNoPrefix()
        {
            string dirPath = AsCrossPlatformPath("./home/Galerie");

            string[] fileNames = CreateSomeFileNames();
            var      directory = new DirectoryNodeInfo(dirPath, null, fileNames);

            Mock <IFileSystemAccess> fileSystemAccessMock = SetupMockForFileSystemAccess();
            var galleryDirectory = new GalleryDirectory(fileSystemAccessMock.Object);

            galleryDirectory.MoveAllImagesToFlatOrder(directory);

            VerifyCallsTo(fileSystemAccessMock, dirPath, directory, $"^\\w+_\\d+\\.{_fileExt}$");
        }
Example #2
0
        public void MoveAllImagesToFlatOrder_WhenFilesAlongSubdirs_ThenThrow()
        {
            string dirPath = AsCrossPlatformPath("./home/Galerie");

            string[]            fileNames = CreateSomeFileNames();
            DirectoryNodeInfo[] subdirs   = { new DirectoryNodeInfo(null, null, null) };
            var directory = new DirectoryNodeInfo(dirPath, subdirs, fileNames);

            Mock <IFileSystemAccess> fileSystemAccessMock = SetupMockForFileSystemAccess();
            var galleryDirectory = new GalleryDirectory(fileSystemAccessMock.Object);

            Assert.ThrowsAny <ApplicationException>(
                () => galleryDirectory.MoveAllImagesToFlatOrder(directory)
                );
        }
Example #3
0
        public void MoveAllImagesToFlatOrder_WhenSubdirectoriesPresent_ThenUsePrefix()
        {
            string dirPath = AsCrossPlatformPath("./home/Galerie");

            string[] fileNames = CreateSomeFileNames();

            DirectoryNodeInfo[] subdirs =
            {
                new DirectoryNodeInfo(Path.Join(dirPath, "A"), null, fileNames),
                new DirectoryNodeInfo(Path.Join(dirPath, "B"), null, fileNames),
            };
            var directory = new DirectoryNodeInfo(dirPath, subdirs, null);

            Mock <IFileSystemAccess> fileSystemAccessMock = SetupMockForFileSystemAccess();
            var galleryDirectory = new GalleryDirectory(fileSystemAccessMock.Object);

            galleryDirectory.MoveAllImagesToFlatOrder(directory);

            VerifyCallsTo(fileSystemAccessMock, dirPath, directory, $"^\\d+_\\w+_\\d+\\.{_fileExt}$");
        }