public async Task <IActionResult> DeleteParticipant(Guid id) { if (!await ParticipantExistsAsync(id)) { return(NotFound()); } await _participantService.DeleteAsync(id); return(NoContent()); }
public async Task Delete_ShouldDeleteParticipant() { // Arrange var options = BuildContextOptions(); Participant participant; using (var context = new BorrowBuddyContext(options)) { participant = context.AddParticipant(); } using (var context = new BorrowBuddyContext(options)) { // Act var service = new ParticipantService(context); await service.DeleteAsync(participant.Id); } using (var context = new BorrowBuddyContext(options)) { // Assert var result = context.Participants.FirstOrDefault(); Assert.Null(result); } }