public void CreateQuestion_Returns201Created_WhenValidObjectSubmitted() { mockRepo.Setup(repo => repo.GetQuestionById(1)).Returns(new Faq { Id = 1, Question = "Who is White Canary?", Answer = "Sara Lance" }); var controller = new FaqController(mockRepo.Object, mapper); var result = controller.CreateQuestion(new FaqCreateDto { }); Assert.IsType <CreatedAtRouteResult>(result.Result); }
public void CreateQuestion_ReturnsCorrectType_WhenIDExists() { mockRepo.Setup(repo => repo.GetQuestionById(1)).Returns(new Faq { Id = 1, Question = "Who is White Canary?", Answer = "Sara Lance" }); var controller = new FaqController(mockRepo.Object, mapper); var result = controller.CreateQuestion(new FaqCreateDto { }); Assert.IsType <ActionResult <FaqReadDto> >(result); }