예제 #1
0
 public void Delete_ShouldRemoveAProfessor()
 {
     // Arrange
     _mockReadRepository.Setup(repo => repo.GetByIdAsync <Professor>(_professor1.Id)).ReturnsAsync(_professor1);
     // Act
     Task.Run(async() =>
     {
         await _professorService.Delete(_professor1.Id);
     }).GetAwaiter().GetResult();
 }
        public async Task <IHttpActionResult> DeleteProfessor(string id)
        {
            Professor professor = await _professors.Find(id);

            if (professor == null)
            {
                return(NotFound());
            }

            await _professors.Delete(professor);

            return(Ok((ProfessorResultViewModel)professor));
        }