Updated voice work delete logic + tests.

This commit is contained in:
2026-05-14 10:19:06 -04:00
parent 8a13f282b1
commit 0ed3bc6298
2 changed files with 25 additions and 2 deletions

View File

@@ -49,4 +49,25 @@ public class Delete_Voice_Work_Tests(MariaDbContainerFixture container) : VoiceW
dbContext.VoiceWorks.FirstOrDefault(x => x.VoiceWorkId == voiceWorkId).ShouldNotBeNull();
dbContext.VoiceWorkSearches.FirstOrDefault(x => x.VoiceWorkId == voiceWorkId).ShouldNotBeNull();
}
[Fact]
public async Task Try_Delete_Missing_Voice_Work()
{
await using AppDbContext dbContext = await GetAppDbContextAsync();
VoiceWorkWriter writer = new(dbContext);
int voiceWorkId = 999;
DeleteVoiceWorkRequest request = new([voiceWorkId]);
dbContext.VoiceWorks.FirstOrDefault(x => x.VoiceWorkId == voiceWorkId).ShouldBeNull();
dbContext.VoiceWorkSearches.FirstOrDefault(x => x.VoiceWorkId == voiceWorkId).ShouldBeNull();
DeleteVoiceWorkResponse response = await writer.DeleteAsync(request, TestContext.Current.CancellationToken);
response.Results.Count.ShouldBe(1);
response.Results.ShouldContainKey(voiceWorkId);
response.Results[voiceWorkId].ShouldBe(DeleteVoiceWorkStatus.NotFound);
dbContext.VoiceWorks.FirstOrDefault(x => x.VoiceWorkId == voiceWorkId).ShouldBeNull();
dbContext.VoiceWorkSearches.FirstOrDefault(x => x.VoiceWorkId == voiceWorkId).ShouldBeNull();
}
}