public Product Get(string name, Action <ProductAssembler> product) { _currentProductId++; var productObj = TestProducts.Product(_currentProductId, name); var productAssembler = new ProductAssembler(); product(productAssembler); _mocks.PriceService.GetPrice(productObj.Info.Id).Returns(productAssembler.Price); return(productObj); }
public ProductsTable AddOrUpdate(string name, Action <ProductAssembler> product) { _currentProductId++; var productObj = TestProducts.Product(_currentProductId, name); var productAssembler = new ProductAssembler(); product(productAssembler); if (_products.ContainsKey(name)) { _products.Remove(name); } _products.Add(name, productObj); _mocks.PriceService.GetPrice(productObj.Info.Id).Returns(productAssembler.Price); return(this); }