public IEnumerable <Product> ProductsByCategory(string categoryName, IPricePolicy pricePolicy) { var products = _productsRepository.GetByCategory(categoryName); foreach (var product in products) { product.Price = pricePolicy.Apply(product.Price); } return(products); }
/// <summary> /// Creates an instance of the store having references to the repository and price policy. /// </summary> /// <param name="repository">an instance of the repository.</param> /// <param name="pricePolicy">an instance of the price policy.</param> public Store(IRepository repository, IPricePolicy pricePolicy) { this.repository = repository; this.pricePolicy = pricePolicy; }
public void TestInitialize() { policy = new PricePolicy(allTerms); }
public Recipe(IProduct product, IPricePolicy pricePolicy, IEnumerable <Step> steps) { _product = product; _pricePolicy = pricePolicy; _steps = steps; }