public async Task Delete_given_id_calls_DeleteAsync() { // Arrange var repository = new Mock <IStudyRepository>(); var controller = new StudyController(repository.Object, log.Object); // Act await controller.Delete(11); // Assert repository.Verify(r => r.DeleteAsync(11)); }
public async Task Delete_given_valid_study_returns_NoContent() { // Arrange var repository = new Mock <IStudyRepository>(); repository.Setup(r => r.DeleteAsync(11)).ReturnsAsync(true); var controller = new StudyController(repository.Object, log.Object); // Act var result = await controller.Delete(11); // Assert Assert.IsType <NoContentResult>(result); }
public async Task Delete_given_nonexisting_study_returns_NotFound() { // Arrange var repository = new Mock <IStudyRepository>(); repository.Setup(r => r.DeleteAsync(11)).ReturnsAsync(false); var controller = new StudyController(repository.Object, log.Object); // Act var result = await controller.Delete(11); // Assert Assert.IsType <NotFoundResult>(result); }