Ejemplo n.º 1
0
        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);
        }
Ejemplo n.º 2
0
        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));
        }