public async Task DeleteTodo_Should_Throw_ArgumentException_If_TodoId_Is_Empty() { using (var context = _builder.BuildDbContext()) { var services = new TodoServices(context); Guid todoId = Guid.Empty; var ex = await Assert.ThrowsAsync <ArgumentException>(() => services.DeleteTodo(todoId)); Assert.Equal(nameof(todoId), ex.ParamName); } }
public async Task DeleteTodo_Should_Mark_The_Specified_Todo_Item_As_Deleted() { using (var context = _builder.BuildDbContext()) { var todos = new TodoItem[] { TodoItem.NewTodo("text1") }; _builder.PrepareData(context, todos); var services = new TodoServices(context); Guid todoId = context.TodoItems.First().Id; await services.DeleteTodo(todoId); var todo = context.TodoItems.First(t => t.Id == todoId); Assert.True(todo.IsDeleted); _builder.CleanAllData(context); } }