Пример #1
0
        public async Task Can_delete_tasks_with_tags()
        {
            var create = CreateNewTask();

            create.Tags.Add("a");
            create.Tags.Add("b");
            create.Tags.Add("c");

            await Store.SaveAsync(create);

            var created = await Store.GetByIdAsync(create.Id);

            Assert.NotNull(created, $"Created task with ID '{create.Id}' is not visible");

            await Store.DeleteAsync(create);

            var deleted = await Store.GetByIdAsync(create.Id);

            Assert.Null(deleted);
        }
Пример #2
0
        public async Task <IActionResult> DeleteBackgroundTask(string id)
        {
            if (string.IsNullOrWhiteSpace(id) || !int.TryParse(id, out var taskId))
            {
                return(new ErrorObjectResult(new Error(ErrorEvents.InvalidRequest, "Invalid task ID")));
            }

            var task = await _store.GetByIdAsync(taskId);

            if (task == null)
            {
                return(NotFound());
            }

            await _store.DeleteAsync(task);

            return(NoContent());
        }