public void DeleteAnswerRemovesItFromDb(int answerId) { //Arrange TestUtils testUtils = new TestUtils(); var db = testUtils.GetDbContext(); this.PopulateDb(db); var sut = new AnswersService(db); //Act sut.Delete(answerId); //Assert Assert.True(!db.Answers.Any(a => a.Id == answerId)); }
public async Task <IActionResult> Delete(int?id) { await _service.Delete(id); return(RedirectToAction(nameof(Index))); }