Beispiel #1
0
        public async Task <IHttpActionResult> CreateOption(Guid productId, ProductOptionRequestDto requestDto)
        {
            var command = new CreateProductOptionCommand(productId, requestDto.Name, requestDto.Description);

            var result = await _productOptionService.CreateProductOption(command);

            if (!result.IsSuccess)
            {
                return(BadRequest(result.FailureReason));
            }

            return(Ok());
        }
        public void CreateProductOption_saves_a_ProductOption_via_repository()
        {
            //Arrange
            var productOption = new core.Models.ProductOption {
                Id = new Guid(), ProductId = new Guid("de1287c0-4b15-4a7b-9d8a-dd21b3cafec3"), Name = "Rose Gold", Description = "Gold Apple iPhone 6S"
            };

            //Act
            _productOptionService.CreateProductOption(productOption);
            var count = _mockContext.ProductOptions.Local.Count;

            //Assert
            Assert.AreEqual(count, 4);
        }
 public void CreateOption(Guid productId, ProductOption option)
 {
     option.ProductId = productId;
     _productOptionService.CreateProductOption(option);
 }