public async void GetDashboardByProjectIdWillReturnNotFoundForInvalidId() { _mockedRepository.Setup(x => x.GetDashboardByProjectId(It.IsAny <int>())).ReturnsAsync(() => null); var myController = new DashboardsController(_mockedRepository.Object); var actionResult = await myController.GetDashboardByProjectId(It.IsAny <int>()); Assert.NotNull(actionResult); Assert.IsType <NotFoundResult>(actionResult.Result); }
public async void GetDashboardByProjectIdWillReturnOkResultForValidId() { _mockedRepository.Setup(x => x.GetDashboardByProjectId(It.IsAny <int>())).ReturnsAsync(_dashboards); var myController = new DashboardsController(_mockedRepository.Object); var actionResult = await myController.GetDashboardByProjectId(It.IsAny <int>()); var result = actionResult.Result as OkObjectResult; Assert.NotNull(result); Assert.IsType <OkObjectResult>(result); Assert.Equal(_dashboards, result.Value); }