public void CreateColorIfNotExists_Calls_Create_In_Repo() { var testDescription = "test"; var color = new BikeColorEntity(); var dto = new BikeColorDto { Description = testDescription }; mockRepo.Setup(r => r.Insert(It.IsAny <BikeColorEntity>())).Returns(color); bikeColorService.CreateColorIfNotExists(dto); mockRepo.Verify(r => r.Insert(It.IsAny <BikeColorEntity>()), Times.Once); }
public IActionResult CreateBikeColorIfNotExists(CreateBikeColorRequest request) { var colorToInsert = _mapper.Map <BikeColorDto>(request); var color = _bikeColorService.CreateColorIfNotExists(colorToInsert); return(CreatedAtAction(nameof(GetBikeColor), new { id = color.Id }, color)); }