コード例 #1
0
 public IHttpActionResult CreateOption(ProductOptionView option)
 {
     try
     {
         _productOptionLibrary.Create(option);
         return(Ok());
     }
     catch (Exception ex)
     {
         return(BadRequest(ex.Message + ex.InnerException?.Message + ex.InnerException?.StackTrace));
     }
 }
コード例 #2
0
        public void Create()
        {
            var countShouldBe = _productOptions.Count + 1;

            var product = new ProductOption()
            {
                Id = Guid.NewGuid(), Name = "Whitish", Description = "Very whitish!!", ProductId = Guid.Parse("8F2E9176-35EE-4F0A-AE55-83023D2DB1A3")
            };

            _productOptionLibrary.Create(MapProductOptionToProductOptionView(product));
            var countIs = _productOptions.Count;

            Assert.AreEqual(countIs, countShouldBe);
        }