public void ProductSpecificationAttributeController_Index_CallsProductOptionManagerListSpecificationAttributes() { var controller = GetProductSpecificationAttributeController(); controller.Index(); A.CallTo(() => _productOptionManager.ListSpecificationAttributes()).MustHaveHappened(); }
public PartialViewResult AddSpecification(Product product) { ViewData["product"] = product; List <ProductSpecificationAttribute> attributes = _productOptionManager.ListSpecificationAttributes() .ToList() .Where( x => product.SpecificationValues.All( v => v.ProductSpecificationAttributeOption.ProductSpecificationAttribute.Id != x.Id)) .ToList(); ViewData["specification-attributes"] = new SelectList(attributes, "Id", "Name"); List <ProductSpecificationAttributeOption> options = attributes.Any() ? attributes.First().Options.OrderBy(x => x.DisplayOrder).ToList() : new List <ProductSpecificationAttributeOption>(); options.Add(new ProductSpecificationAttributeOption { Id = 0, Name = "Other" }); ViewData["specification-attributes-options"] = new SelectList(options, "Id", "Name"); return(PartialView(new ProductSpecificationValue { Product = product })); }
public ViewResult Index() { var options = _productOptionManager.ListSpecificationAttributes(); return(View(options)); }