Updated voice work delete logic + tests.
This commit is contained in:
@@ -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();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user