Ejemplo n.º 1
0
        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));
        }
Ejemplo n.º 2
0
        public async Task <IActionResult> Delete(int?id)
        {
            await _service.Delete(id);

            return(RedirectToAction(nameof(Index)));
        }