public OrderCreationUseCaseTest() { var food = new Category { Name = "food", TaxPercentage = 10m }; _productCatalog = new InMemoryProductCatalog(new List <Product> { new Product { Name = "salad", Price = 3.56m, Category = food }, new Product { Name = "tomato", Price = 4.65m, Category = food } }); _orderRepository = new TestOrderRepository(); _useCase = new OrderCreationUseCase(_orderRepository, _productCatalog); }
public CashRegisterProcessor( IProductCatalog productCatalog, ICashRegisterRenderer cashRegisterRenderer) { _productCatalog = productCatalog; _cashRegisterRenderer = cashRegisterRenderer; }
Product[] GetProductDetails(IProductCatalog client, IEnumerable<string> productIds) { if (productIds == null) throw new ArgumentNullException("productIds"); if (!productIds.Any()) return new Product[] { }; var products = productIds .Chunk(10) .SelectMany ( chunk => { var query = new ProductQuery { Page = 1, PageSize = int.MaxValue, SearchTerms = string.Join(" ", chunk.ToArray()), SearchField = ProductQuery.SearchFields.ProductId }; return client.Search(query).Products; } ) .ToArray(); return products; }
public void MultipleProducts_Mocks() { // Arrange var cart = A.Fake <ICart>(); A.CallTo(() => cart.Products).Returns(new [] { new ProductToPurchase { ProductId = 1, Quantity = 1 }, new ProductToPurchase { ProductId = 42, Quantity = 7 }, }); IProductCatalog mockProductCatalog = A.Fake <IProductCatalog>(); A.CallTo(() => mockProductCatalog.LookupPrice(1)).Returns(1m); A.CallTo(() => mockProductCatalog.LookupPrice(42)).Returns(1.5m); ITaxCalculator mockTaxCalculator = A.Fake <ITaxCalculator>(); A.CallTo(() => mockTaxCalculator.CalculateTaxes(11.5m)).Returns(1.15m); // Act var calculator = new PricingCalculator(mockProductCatalog, mockTaxCalculator); PricingSummary price = calculator.PriceCart(cart); // Assert Assert.That(price.ProductPrices.Count, Is.EqualTo(2)); Assert.That(price.SubTotal, Is.EqualTo(11.5m)); Assert.That(price.Taxes, Is.EqualTo(1.15m)); Assert.That(price.Total, Is.EqualTo(12.65m)); }
public OrderCreationUseCase( IOrderRepository orderRepository, IProductCatalog productCatalog) { _orderRepository = orderRepository; _productCatalog = productCatalog; }
/// <summary> /// Constructor /// </summary> /// <param name="catalogus">The product catalogus to supply the products and /// search of products</param> public Till(IProductCatalog catalogus, ICashRegister cashRegister) { if (catalogus == null || cashRegister == null) { throw new ArgumentNullException("The catalog or register does not exist"); } this.Catalog = catalogus; this.Register = cashRegister; }
public OrderRepository(PaymentHandler paymentHandler, IProductCatalog productCatalog, IPaymentService paymentService) { orders = new Order[] {}; this.paymentHandler = paymentHandler; this.productCatalog = productCatalog; this.paymentService = paymentService; }
public PaymentHandler(Func <IPackingSlipBuilder> _packingSlipBuilder, IProductCatalog productCatalog, IMembershipService membershipService, ICommisionService commisionService) { packingSlipBuilder = _packingSlipBuilder; this.productCatalog = productCatalog; this.membershipService = membershipService; this.commisionService = commisionService; }
/// <summary> /// Constructor /// </summary> /// <param name="catalogus">The product catalogus to supply the products and search of products</param> public Till(IProductCatalog catalogus) { if (catalogus == null) { throw new ObjectIsNullException("The catalog does not exist"); } this.List = catalogus; // throw new NotImplementedException(); }
public ProductValidatorManager(IProductCatalog productCatalog) { this.productCatalog = productCatalog; validatorMap = new Dictionary <Type, IProductValidator> { { typeof(Product), new ProductValidator() }, { typeof(Book), new BookValidator(productCatalog) }, { typeof(Toy), new ToyValidator(productCatalog) }, { typeof(Appliances), new AppliancesValidator(productCatalog) } }; }
public OrderCreationUseCaseTest() { orderRepository = new TestOrderRepository(); food = new Category("Food", 10m); productCatalogue = new InMemoryProductCatalog( new List <Product>() { new Product("salad", food, 3.56m), new Product("tomato", food, 4.65m) }); useCase = new OrderCreationUseCase(orderRepository, productCatalogue); }
public void SetUp() { orderRepository = new TestOrderRepository(); food = new Category { Name = "Food", TaxPercentage = new decimal(10) }; productCatalogue = new InMemoryProductCatalog( new List <Product> { new Product { Category = food, Name = "salad", Price = new decimal(3.56) }, new Product { Category = food, Name = "tomato", Price = new decimal(4.65) } }); useCase = new OrderCreationUseCase(orderRepository, productCatalogue); }
public ListCommand(IProductCatalog productCatalog, string[] args) { productTypeDoesntExist = resourceManager.GetString("LIST_PRODUCTTYPEDOESNTEXIST"); usage = resourceManager.GetString("LIST_USAGE"); this.productCatalog = productCatalog; var buffer = new StringBuilder(64); buffer.Append(productTypeDoesntExist); var names = productCatalog.GetTypeNames(); foreach (var name in names) { buffer.Append("-"); buffer.Append(name); buffer.Append(Environment.NewLine); } productTypeDoesntExist = buffer.ToString(); }
public CreateCommand(IProductCatalog productCatalog, string[] args) { productTypeDoesntExist = resourceManager.GetString("CREATE_PRODUCTTYPEDOESNTEXIST"); this.args = args; this.productCatalog = productCatalog; validator = productCatalog.GetValidator(); var buffer = new StringBuilder(64); buffer.Append(productTypeDoesntExist); var names = productCatalog.GetTypeNames(); foreach (var name in names) { buffer.Append("-"); buffer.Append(name); buffer.Append(Environment.NewLine); } productTypeDoesntExist = buffer.ToString(); }
/// <summary> /// /// </summary> /// <param name="productCatalog"></param> public ScannerSessionController(IProductCatalog productCatalog) { _productCatalog = productCatalog; }
public StoreController(IProductCatalog productCatalog, IShoppingCartLocator shoppingCartLocator) { _productCatalog = productCatalog; _shoppingCartLocator = shoppingCartLocator; }
public ProductsController(IProductCatalog catalog) { _catalog = catalog; }
public GetItemCommand(IProductCatalog productCatalog, string[] args) { usage = resourceManager.GetString("GETITEM_USAGE"); this.productCatalog = productCatalog; this.args = args; }
public ProductController(IProductCatalog repo) { repository = repo; }
public OrderCreation(IOrderRepository orderRepository, IProductCatalog productCatalog) { _productCatalog = productCatalog; _orderRepository = orderRepository; }
public PromotionEngine(IProductCatalog productCatalog, IPromotionsCatalog promotionsCatalog) { ProductCatalog = (ProductCatalog)productCatalog; PromotionsCatalog = (PromotionsCatalog)promotionsCatalog; }
public PricingCalculator(IProductCatalog catalogService, ITaxCalculator pricingService) { this.catalog = catalogService; this.taxCalculator = pricingService; }
public ProductsController(IProductCatalog catalog, IShoppingCart cart) { _catalog = catalog; _cart = cart; }
public ProcessOrder(IProductCatalog catalog) { _catalog = catalog; }
public Dispatcher() { productCatalog = new ProductCatalog("product_data"); help = resourceManager.GetString("HELP"); }
public void Setup() { productTestCatalog = new ProductCatalog("testDataCatalog"); productTestCatalog.ClearListCatalog(); }
public ProductsController(IProductCatalog catalog) { this.catalog = catalog; }
public AddCountCommand(IProductCatalog productCatalog, string[] args) { usage = resourceManager.GetString("ADDCOUNT_USAGE"); this.productCatalog = productCatalog; this.args = args; }
private CartController(IProductCatalog productCatalog) { this.productCatalog = productCatalog; }
public ShoppingCartImpl(IProductCatalog catalog) { _catalog = catalog; }
public BookValidator(IProductCatalog productCatalog) { this.productCatalog = productCatalog; }
public SubstractCountCommand(IProductCatalog productCatalog, string[] args) { usage = resourceManager.GetString("SUBSTRACTCOUNT_USAGE"); this.productCatalog = productCatalog; this.args = args; }