コード例 #1
0
 public void WhenIAskTheFolderDeleterToDeleteTheFolder()
 {
     try {
         Sut.DeleteFolder(Folder);
     } catch { // ignored
     }
 }
コード例 #2
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);
            }
        }