コード例 #1
0
 // Just reduce syntax to create test data.
 private void ScanProducts(PointOfSaleTerminal terminal, params string[] products)
 {
     foreach (var product in products)
     {
         terminal.Scan(product);
     }
 }
コード例 #2
0
        public void UnrecognizedBarCode()
        {
            var pos = new PointOfSaleTerminal(display, new InMemoryGateway());

            pos.OnBarcode("bad");

            display.Displayed.Should().Be("Error");
        }
コード例 #3
0
        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");
        }
コード例 #4
0
        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);
        }
コード例 #5
0
 public void Setup()
 {
     _terminal = new PointOfSaleTerminal();
 }