// Just reduce syntax to create test data. private void ScanProducts(PointOfSaleTerminal terminal, params string[] products) { foreach (var product in products) { terminal.Scan(product); } }
public void UnrecognizedBarCode() { var pos = new PointOfSaleTerminal(display, new InMemoryGateway()); pos.OnBarcode("bad"); display.Displayed.Should().Be("Error"); }
public void RecognizedBarCode() { var gateway = new InMemoryGateway(); gateway.AddItem(new Item { Barcode = "good", Price = 2.22 }); var pos = new PointOfSaleTerminal(display, gateway); pos.OnBarcode("good"); display.Displayed.Should().Be("$2.22"); }
public void TotalPriceIsEqualTo7_25_IfItemsScannedInOrderABCD() { //Arrange var pointOfSaleTerminal = new PointOfSaleTerminal(_productService, _priceCalculator); pointOfSaleTerminal.Reset(); pointOfSaleTerminal.Scan("A"); pointOfSaleTerminal.Scan("B"); pointOfSaleTerminal.Scan("C"); pointOfSaleTerminal.Scan("D"); //Act var price = pointOfSaleTerminal.CalculateTotal(); //Assert Assert.AreEqual(7.25m, price); }
public void Setup() { _terminal = new PointOfSaleTerminal(); }