/// <summary>
 /// Gets all Questions Sets available.
 /// </summary>
 /// <returns>Questions set list.</returns>
 public ResponseDTO <IEnumerable <QuestionsSetDTO> > GetQuestionsSets()
 {
     try
     {
         return(_questionsSetService.GetQuestionsSets());
     }
     catch (NoContentException)
     {
         return(ResponseDTO <IEnumerable <QuestionsSetDTO> > .NoContent("No questions sets were found."));
     }
     catch (Exception ex)
     {
         _logger.Error(ex, "Failed to fetch QuestionsSet list.");
         return(ResponseDTO <IEnumerable <QuestionsSetDTO> > .InternalError(
                    ErrorMessageHelper.FailedOperation("fetching Questions Sets available")));
     }
 }
Beispiel #2
0
 public void GetQuestionsSetsShouldThrowNoContentException()
 {
     _repositoryMock.Setup(repo => repo.GetAll()).Returns(new List <QuestionsSet>());
     Assert.Throws <NoContentException>(() => _service.GetQuestionsSets());
 }