public void GetCareerById_GetNullValue_ShouldThrowException() { //arrange careerRepository.Setup(x => x.Get(It.IsAny <int>())).Returns <Career>(null); // act & assert NUnit.Framework.Assert.IsNull(carService.GetCareerById(It.IsAny <int>())); }
public ActionResult Details(Guid?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } Career career = _service.GetCareerById(id); CareerViewModel viewModelList = Mapper.Map <Career, CareerViewModel>(career); return(View(viewModelList)); }
public IHttpActionResult GetCareer(int id) { //try //{ CareerViewModel careerView = Mapper.Map <CareerDTO, CareerViewModel>(careerService.GetCareerById(id)); if (careerView == null) { return(Content(System.Net.HttpStatusCode.NoContent, "Not found career")); } else { return(Ok(careerView)); } //} //catch (ArgumentOutOfRangeException ex) //{ // return Content(System.Net.HttpStatusCode.NoContent, ex.ParamName); //} }