public async Task RemoveSetAsync_WhenCalled_RemoveSetFromDbAsync() { var set = _setUpContext.Sets.Find(1); await _setService.RemoveSetAsync(set); var removedSet = _context.Sets.FirstOrDefault(q => q.Id == 1); Assert.That(removedSet, Is.Null); }
public async Task <IActionResult> OnPostAsync(int?id) { if (id == null) { return(NotFound()); } this.Set = await _setService.GetSetByIdAsync((int)id); if (Set != null) { await _setService.RemoveSetAsync(this.Set); } return(RedirectToPage("./Index")); }