public void AddSportUniqueNameOkTest() { sportBL.Add(new Sport { Name = "Basquetbol" }); mockSportRepo.Verify(x => x.Insert(It.IsAny <Sport>()), Times.Once()); }
public ActionResult CreateSport([FromBody] SportCreateDTO data) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } try { var sport = mapper.Map <Sport>(data); sportBusinessLogic.Add(sport); return(Ok(mapper.Map <SportDTO>(sport))); } catch (SportException e) { return(BadRequest(e.Message)); } catch (Exception e) { return(StatusCode(500, e.Message)); } }