Ejemplo n.º 1
0
        private void CleanUpFolder(IFolder folder, IErrorsAndInfos errorsAndInfos)
        {
            if (!folder.Exists())
            {
                return;
            }

            if (!FolderDeleter.CanDeleteFolder(folder))
            {
                errorsAndInfos.Errors.Add($"Folder deleter refuses to delete {folder.FullName}");
                return;
            }

            try {
                foreach (var file in Directory.GetFiles(folder.FullName, "*.*", SearchOption.AllDirectories))
                {
                    File.SetAttributes(file, FileAttributes.Normal);
                }
                FolderDeleter.DeleteFolder(folder);
            } catch (Exception e) {
                errorsAndInfos.Errors.Add($"Could not delete {folder.FullName}");
                errorsAndInfos.Errors.Add(e.Message);
            }
        }
Ejemplo n.º 2
0
 public void WhenIAskTheFolderDeleteIfIAmAllowedToDeleteTheFolder()
 {
     CanDeleteFolder = Sut.CanDeleteFolder(Folder);
 }