Esempio n. 1
0
        public void GetTotalPrice_EmptyList_ReturnSumOfZero()
        {
            List <Deal> deals = new List <Deal>();

            MyProvider provider = new MyProvider();

            var result = provider.GetTotalPrice(deals, "normalPrice");

            Assert.AreEqual(result, 0);
        }
Esempio n. 2
0
        private void UpdateMyListView()
        {
            List <Deal> deals = new List <Deal>();

            foreach (string id in myList)
            {
                deals.Add(provider.GetDeal(id));
            }

            PopulateListView(deals, myListView);

            float totalSalePrice   = provider.GetTotalPrice(deals, SALE_PRICE);
            float totalNormalPrice = provider.GetTotalPrice(deals, NORMAL_PRICE);

            txtTotalPrice.Text  = totalSalePrice.ToString() + "€";
            txtOnSaleSaved.Text = (totalNormalPrice - totalSalePrice).ToString() + "€";

            PopulateListView(provider.GetCheaperDeals(deals), cheapestItemsListView);
        }
Esempio n. 3
0
        public void GetTotalPrice_PopulatedlistNonFloatProperty_ReturnSumOfZero()
        {
            List <Deal> deals = new List <Deal>()
            {
                new Deal {
                    id = "1"
                },
                new Deal {
                    id = "2"
                },
                new Deal {
                    id = "3"
                }
            };

            MyProvider provider = new MyProvider();

            var result = provider.GetTotalPrice(deals, "id");

            Assert.AreEqual(result, 0);
        }
Esempio n. 4
0
        public void GetTotalPrice_PopulatedListNormalPrice_ReturnTotalNormalPrice()
        {
            List <Deal> deals = new List <Deal>()
            {
                new Deal {
                    normalPrice = 10
                },
                new Deal {
                    normalPrice = 10
                },
                new Deal {
                    normalPrice = 10
                }
            };

            MyProvider provider = new MyProvider();

            var totalNormalPrice = 30;

            var result = provider.GetTotalPrice(deals, "normalPrice");

            Assert.AreEqual(result, totalNormalPrice);
        }