Exemplo n.º 1
0
        static void Main()
        {
            Console.WriteLine("Hello YouScan!");

            var priceProvider = new PriceProvider();

            priceProvider.SetPricing(
                new List <Price>
            {
                new Price {
                    Name = "A", ItemPrice = 125m, Volumes = new Dictionary <int, decimal> {
                        { 3, 300 }
                    }
                },
                new Price {
                    Name = "B", ItemPrice = 425m
                },
                new Price {
                    Name = "C", ItemPrice = 100, Volumes = new Dictionary <int, decimal> {
                        { 6, 500 }
                    }
                },
                new Price {
                    Name = "D", ItemPrice = 75m
                }
            });

            var discountProvider = new DiscountProvider();

            discountProvider.SetDicountTable(
                new List <DiscountSet>
            {
                new DiscountSet {
                    StartingValue = 1000, Discount = 1
                },
                new DiscountSet {
                    StartingValue = 2000, Discount = 3
                },
                new DiscountSet {
                    StartingValue = 5000, Discount = 5
                },
                new DiscountSet {
                    StartingValue = 9999, Discount = 7
                }
            });


            _terminal = new PointOfSaleTerminal(priceProvider, new DiscountCardRepository(), discountProvider);

            Run("ABCDABA");
            Run("CCCCCCC");
            Run("ABCD");
        }
Exemplo n.º 2
0
 public DiscountProviderTests()
 {
     _sut = new DiscountProvider();
     _sut.SetDicountTable(
         new List <DiscountSet>
     {
         new DiscountSet {
             StartingValue = 1000, Discount = 1
         },
         new DiscountSet {
             StartingValue = 2000, Discount = 3
         },
         new DiscountSet {
             StartingValue = 5000, Discount = 5
         },
         new DiscountSet {
             StartingValue = 9999, Discount = 7
         }
     });
 }