Пример #1
0
        public void GivenProductsAddedWhenCalculatingTotalThenTotalReturned()
        {
            var weightProduct = new WeightProduct {
                Name = "Gala Apple", Price = 49
            };
            var quantityProduct = new QuantityProduct {
                Name = "Lucky Stars 500g", Price = 399
            };

            _cashRegister.AddProduct(weightProduct, 100);
            _cashRegister.AddProduct(quantityProduct, 2);

            var total = _cashRegister.CalculateTotal(null, null);

            Assert.That(total, Is.EqualTo(5698));
        }
Пример #2
0
        static void Main(string[] args)
        {
            #region Init

            //  Liste Produits

            //  Produit |  Prix
            //  -----------------
            //   A      |  50
            //   B      |  25
            //   C      |  30



            //  Discounts

            //  CodeProduit  | Nombre  | %
            //  ------------------------------
            //  A            | 3       | 0.25
            //  B            | 5       | 0.10



            Console.WriteLine("Scannez les produits");
            //AABBCC...
            var scannedProduct = Console.ReadLine();


            //TODO
            ////////////////////////////////////////


            //List<Product> catalog =
            //List<Discount> discounts =
            //List<char> productsList =

            #endregion



            var total = CashRegister.CalculateTotal(catalog, discounts, productsList);

            //Affichage du total
            Console.WriteLine(total);
            //Pause program
            Console.ReadLine();
        }