示例#1
0
        public async Task ShouldCreateProductLine()
        {
            var ProductCategoryId = Guid.NewGuid();
            var ProductLineId     = Guid.NewGuid();
            var model             = new ProductLineRequestModel
            {
                Name = "Nokia 320",
                ProductCategoryId = ProductCategoryId
            };

            var ProductCategory = new ProductCategoryResponseModel
            {
                CategoryName = "celular"
            };

            _productCategoryService.GetById(ProductCategoryId).Returns(ProductCategory);

            await _productLineService.Create(model);

            await _productLineRepository.Received(1)
            .Create(Arg.Is <ProductLine>(x => x.Name.ToString() == model.Name && x.ProductCategoryId == ProductCategoryId));
        }
        public async Task <IActionResult> Create([FromBody] ProductLineRequestModel request)
        {
            await _productLineService.Create(request);

            return(Accepted());
        }