public async Task GetRandomAsyncBadRequestFailureTest() { // Arrange const string invalidLevel = "invalid"; IQbQuestionService qbQuestionService = Substitute.For <IQbQuestionService>(); QbQuestionsController controller = new QbQuestionsController(qbQuestionService, mapper); // Act IActionResult result = await controller.GetRandomAsync(invalidLevel); // Assert result.Should().BeOfType <BadRequestResult>(); }
public async Task GetRandomAsyncFailureTest() { // Arrange IQbQuestionService qbQuestionService = Substitute.For <IQbQuestionService>(); QbQuestion question = null; qbQuestionService.GetRandomAsync(Arg.Any <int?>()).Returns(question); QbQuestionsController controller = new QbQuestionsController(qbQuestionService, mapper); // Act IActionResult result = await controller.GetRandomAsync(null); // Assert result.Should().BeOfType <NotFoundResult>(); }