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)); }
static void Run(string input) { input.ToList().ForEach(x => _terminal.Scan(x.ToString())); _terminal.ScanDiscountCard(_customerId); Console.WriteLine($"Total for {input}: {_terminal.Bill()}"); }
public void Run() { var products = new List <ProductDTO> { new ProductDTO { Code = "A", RetailPrice = 1.25m, VolumePrice = 3m, VolumeQuantity = 3 }, new ProductDTO { Code = "B", RetailPrice = 4.25m }, new ProductDTO { Code = "C", RetailPrice = 1m, VolumePrice = 5m, VolumeQuantity = 6 }, new ProductDTO { Code = "D", RetailPrice = 0.75m } }; terminal.SetPricing(products); terminal.Scan("A"); terminal.Scan("B"); terminal.Scan("C"); terminal.Scan("D"); terminal.Scan("A"); terminal.Scan("B"); terminal.Scan("A"); Console.WriteLine($"ABCDABA = 13.25? Result: {terminal.CalculateTotal()}"); Console.ReadLine(); }
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 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); } } }