private void SetUpPricing()
 {
     _terminal.SetPricing(SellerClient.CreateProduct("A", 1.25m, 3, 3m));
     _terminal.SetPricing(SellerClient.CreateProduct("B", 4.25m));
     _terminal.SetPricing(SellerClient.CreateProduct("C", 1m, 6, 5m));
     _terminal.SetPricing(SellerClient.CreateProduct("D", 0.75m));
 }
Example #2
0
        public void CanCreateVolumeProduct()
        {
            // Assert
            Product product;

            // Act
            product = SellerClient.CreateProduct("A", 1.25m, 3, 3m);
            var result = product as VolumeProduct;

            // Arrange
            Assert.NotNull(result);
            Assert.Equal(3m, result.VolumePrice);
        }
        public void CanScanProduct()
        {
            // Assert
            _terminal = new PointOfSaleTerminal();
            var product = SellerClient.CreateProduct("A", 1.25m, 3, 3m);

            // Act
            _terminal.SetPricing(product);
            var returnedProduct = _terminal.Scan("A");

            // Arrange
            Assert.NotNull(returnedProduct);
            Assert.Equal(1.25m, returnedProduct.Price);
        }
Example #4
0
        public void CanCreateUnitProduct()
        {
            // Assert
            Product product;

            // Act
            product = SellerClient.CreateProduct("A", 1.25m);
            var result = product is VolumeProduct;

            // Arrange
            Assert.False(result);
            Assert.NotNull(product);
            Assert.Equal(1.25m, product.Price);
        }
Example #5
0
        public void CanCalculateTotal()
        {
            // Assert
            const int count   = 10;
            var       product = SellerClient.CreateProduct("A", 1.25m, 3, 3m);

            // Act
            for (var i = 0; i < count; i++)
            {
                product.Buy();
            }

            // Arrange
            Assert.NotNull(product);
            Assert.Equal(10.25m, product.Cost);
        }
Example #6
0
        public void CanBuyProduct()
        {
            // Assert
            const int count   = 10;
            var       product = SellerClient.CreateProduct("A", 1.25m);

            // Act
            for (var i = 0; i < count; i++)
            {
                product.Buy();
            }

            // Arrange
            Assert.NotNull(product);
            Assert.Equal(count, product.Count);
        }