public IHttpActionResult CampusByID(int id) { var campus = _campusService.GetCampusByID(id); if (campus != null) { return(Ok(campus)); } return(NotFound()); }
public void WhenGettingCampusById_AssertCampusReturned() { _campusServiceMock.GetCampusByID(Arg.Any <int>()).Returns(new CampusDTO { }); var campusActionResult = _campusController.CampusByID(5) as OkNegotiatedContentResult <CampusDTO>; var campus = campusActionResult.Content; Assert.NotNull(campus); }
public void WhenGettingCampusById_AssertReturnedCampus(int id) { var campus = _campusService.GetCampusByID(id); Assert.Equal(id, campus.ID); }