Ejemplo n.º 1
0
        private int Scan(IList <string> shoppingCart)
        {
            int total = 0;

            int apples = Search(shoppingCart.ToArray(), APPLE);

            int[] temArrApple = new int[apples];
            for (int i = 0; i < temArrApple.Length; i++)
            {
                temArrApple[i] = APPLE_COST;
            }

            total += _offerServiceFactory.OfferFor(APPLE).Apply(temArrApple);

            int oranges = Search(shoppingCart.ToArray(), ORANGE);

            int[] temArrOrange = new int[oranges];
            for (int i = 0; i < temArrOrange.Length; i++)
            {
                temArrOrange[i] = ORANGE_COST;
            }
            total += _offerServiceFactory.OfferFor(ORANGE).Apply(temArrOrange);

            return(total);
        }
Ejemplo n.º 2
0
        public virtual void shouldObtainBuy3For2OfferService()
        {
            //given

            //when

            //then
            Assert.IsInstanceOfType(_factory.OfferFor("Orange"), typeof(Buy3For2OfferService));
        }