public async Task Given_GetProfessorById_When_IdIsValid_Then_OkStatusCode() { //Arrange var guid = new Guid("ef7e98df-26ed-4b21-b874-c3a2815d18ac"); //mockRepo.Setup(p => p.GetCourseByProfId(guid)).Returns(Task.FromResult(new ProfessorDetailsModel())); // Act var result = await controller.GetProfessorById(guid); // Assert Assert.IsType <OkObjectResult>(result); }
public async Task Given_GetProfessorById_When_IdIsValidButNoCourseFound_Then_BadStatusCode() { //Arrange mockRepo.Setup(p => p.FindById(It.IsIn <Guid>())).Returns(Task.FromResult <ProfessorDetailsModel>(null)); var controller = new ProfessorController(mockRepo.Object); // Act var result = (StatusCodeResult)await controller.GetProfessorById(It.IsAny <Guid>()); // Assert Assert.Equal(422, result.StatusCode); }