private void SetPricing(IPointOfSaleTerminal posTerminal) { posTerminal.SetProductRetailPrice("A", 1.25); posTerminal.SetProductWholesalePrice("A", 3, 3); posTerminal.SetProductRetailPrice("B", 4.25); posTerminal.SetProductRetailPrice("C", 1); posTerminal.SetProductWholesalePrice("C", 6, 5); posTerminal.SetProductRetailPrice("D", 0.75); }
private static void SetDefaultPrices(IPointOfSaleTerminal terminal) { terminal.SetPricing("A", 1.25m); terminal.SetPricing("A", 3, 3m); terminal.SetPricing("B", 4.25m); terminal.SetPricing("C", 1m); terminal.SetPricing("C", 6, 5m); terminal.SetPricing("D", 0.75m); }
static void Main() { Console.WriteLine("Hello YouScan!"); var priceProvider = new PriceProvider(); priceProvider.SetPricing( new List <Price> { new Price { Name = "A", ItemPrice = 125m, Volumes = new Dictionary <int, decimal> { { 3, 300 } } }, new Price { Name = "B", ItemPrice = 425m }, new Price { Name = "C", ItemPrice = 100, Volumes = new Dictionary <int, decimal> { { 6, 500 } } }, new Price { Name = "D", ItemPrice = 75m } }); var discountProvider = new DiscountProvider(); discountProvider.SetDicountTable( new List <DiscountSet> { new DiscountSet { StartingValue = 1000, Discount = 1 }, new DiscountSet { StartingValue = 2000, Discount = 3 }, new DiscountSet { StartingValue = 5000, Discount = 5 }, new DiscountSet { StartingValue = 9999, Discount = 7 } }); _terminal = new PointOfSaleTerminal(priceProvider, new DiscountCardRepository(), discountProvider); Run("ABCDABA"); Run("CCCCCCC"); Run("ABCD"); }
public void When_InPackTerminalProductSetABCD_Expected_TotallPrice7_25() { const decimal expected = 7.25m; IPointOfSaleTerminal terminal = components.Resolve <IPointOfSaleTerminal>(); terminal.Scan("A"); terminal.Scan("B"); terminal.Scan("C"); terminal.Scan("D"); var result = terminal.CalculateTotal(); Assert.That(result, Is.EqualTo(expected)); }
public void When_InPackTerminalProductSetCCCCCCC_Expected_TotallPrice6_00() { const decimal expected = 6.00m; IPointOfSaleTerminal terminal = components.Resolve <IPointOfSaleTerminal>(); terminal.Scan("C"); terminal.Scan("C"); terminal.Scan("C"); terminal.Scan("C"); terminal.Scan("C"); terminal.Scan("C"); terminal.Scan("C"); var result = terminal.CalculateTotal(); Assert.That(expected, Is.EqualTo(result)); }
private static void Init() { var productA = new ProductA(); var productB = new ProductB(); var productC = new ProductC(); var productD = new ProductD(); List <Product> products = new List <Product> { productA, productB, productC, productD }; PointOfSale = new POS(products); Terminal = new Terminal(PointOfSale); Utils.DoSafe(() => { Terminal.SetPricing(productA.Code, (decimal)1.25d); }); Utils.DoSafe(() => { Terminal.SetPricing(productA.Code, (decimal)3.00d, 3); }); Utils.DoSafe(() => { Terminal.SetPricing(productB.Code, (decimal)4.25d); }); Utils.DoSafe(() => { Terminal.SetPricing(productC.Code, (decimal)1.00d); }); Utils.DoSafe(() => { Terminal.SetPricing(productC.Code, (decimal)5.00d, 6); }); Utils.DoSafe(() => { Terminal.SetPricing(productD.Code, (decimal)0.75d); }); }
private static void ScanProducts(IPointOfSaleTerminal terminal) { Console.Write("Products: "); var products = Console.ReadLine(); var productNames = products.Select(n => n.ToString()); foreach (var productName in productNames) { try { Console.WriteLine($"Scanning product \"{productName}\""); terminal.Scan(productName); } catch (ProductNotFoundException ex) { Console.WriteLine(ex.Message); } } }
public CustomerService(IPointOfSaleTerminal terminal) { _terminal = terminal; }
public BaseTests(DataFixture fixture) { this.OrderService = new OrderService(fixture.ProductRepository, fixture.OrderRepository); this.ProductService = new ProductService(fixture.ProductRepository); this.PointOfSaleTerminal = new PointOfSaleTerminal(this.ProductService, this.OrderService); }
public void Dispose() { _terminal = null; }
public void Create() { _terminal = new PointOfSaleTerminal(PRODUCT_PRICES, VOLUME_PRICES); }
public ConsoleApplication(IPointOfSaleTerminal terminal) { this.terminal = terminal; }