using ClaudeDo.Data; using ClaudeDo.Data.Models; using ClaudeDo.Data.Repositories; using ClaudeDo.Worker.Tests.Infrastructure; using Xunit; namespace ClaudeDo.Worker.Tests.Repositories; public sealed class ListRepositoryDeleteConfigTests : IDisposable { private readonly DbFixture _db = new(); private readonly ClaudeDoDbContext _ctx; private readonly ListRepository _repo; public ListRepositoryDeleteConfigTests() { _ctx = _db.CreateContext(); _repo = new ListRepository(_ctx); } public void Dispose() { _ctx.Dispose(); _db.Dispose(); } [Fact] public async Task DeleteConfigAsync_RemovesExistingRow() { var listId = Guid.NewGuid().ToString(); await _repo.AddAsync(new ListEntity { Id = listId, Name = "L", CreatedAt = DateTime.UtcNow, }); await _repo.SetConfigAsync(new ListConfigEntity { ListId = listId, Model = "opus", SystemPrompt = "hello", AgentPath = "/tmp/a.md", }); var removed = await _repo.DeleteConfigAsync(listId); Assert.True(removed); Assert.Null(await _repo.GetConfigAsync(listId)); } [Fact] public async Task DeleteConfigAsync_ReturnsFalseWhenAbsent() { var removed = await _repo.DeleteConfigAsync(Guid.NewGuid().ToString()); Assert.False(removed); } }