Example #1
0
        public async Task DeleteFolder_FolderDeleted()
        {
            var db      = CreateAndSeedDb();
            var service = new FolderService(db);

            await service.DeleteFolderAsync("895973FB-F8E1-4FD6-89C4-DC13CED4780E", 1);

            Assert.DoesNotContain(db.Folders, folder => folder.Id == 1);
        }
Example #2
0
        public async Task DeleteFolder_UserHasNoRights_ExceptionThrown()
        {
            var db      = CreateAndSeedDb();
            var service = new FolderService(db);

            await Assert.ThrowsAsync <AccessDeniedException>(async() =>
            {
                await service.DeleteFolderAsync("895973FB-F8E1-4FD6-89C4-DC13CED4780E", 2);
            });
        }
Example #3
0
        public async Task DeleteFolder_FolderDoesNotExist_ExceptionThrown()
        {
            var db      = CreateAndSeedDb();
            var service = new FolderService(db);

            await Assert.ThrowsAsync <ResourceNotFoundException>(async() =>
            {
                await service.DeleteFolderAsync("895973FB-F8E1-4FD6-89C4-DC13CED4780E", 4);
            });
        }
Example #4
0
        private async Task DeleteFolder()
        {
            try
            {
                await FolderService.DeleteFolderAsync(_folderId);

                await logger.LogInformation("Folder Deleted {Folder}", _folderId);

                AddModuleMessage("Folder Deleted", MessageType.Success);
            }
            catch (Exception ex)
            {
                await logger.LogError(ex, "Error Deleting Folder {Folder} {Error}", _folderId, ex.Message);

                AddModuleMessage("Error Deleting Folder", MessageType.Error);
            }
        }