示例#1
0
 private void PopulateListView(List <Deal> deals, ListView listView)
 {
     if (ShouldPopulateList <Deal>(deals, listView))
     {
         foreach (Deal deal in deals)
         {
             ListViewItem listItem = new ListViewItem(new string[] { deal.title,
                                                                     provider.FindStore(deal.storeID).name,
                                                                     deal.salePrice.ToString() + "€" });
             listItem.Tag = deal;
             listView.Items.Add(listItem);
         }
     }
 }
示例#2
0
        public void FindStore_NonExistingID_ReturnDefaultStore()
        {
            MyProvider provider = new MyProvider();

            provider.stores = new List <Store>()
            {
                new Store {
                    id = 1, isActive = true, name = "Steam"
                },
                new Store {
                    id = 2, isActive = true, name = "GOG"
                },
                new Store {
                    id = 3, isActive = true, name = "Origin"
                }
            };

            var result = provider.FindStore(4);

            Assert.AreEqual("Store not found", result.name);
        }