//Add ny item til liste public void AddNew() { //Test på værdier if (!String.IsNullOrWhiteSpace(NewGrocItem.grocItem) && !String.IsNullOrWhiteSpace(NewGrocItem.itemQnty)) { if (NewGrocItem.itemQnty.All(Char.IsDigit)) { //Instancer et container objekt OutputToUser = String.Empty; GrocItem tempGrocItem = new GrocItem(); tempGrocItem.grocItem = NewGrocItem.grocItem; tempGrocItem.itemQnty = NewGrocItem.itemQnty; //Add til list GrocList.Add(tempGrocItem); } else { OutputToUser = "******"; } } else { OutputToUser = "******"; } }
public void testFoodItemTypes() { FoodTypeService fts = new FoodTypeService(); GrocItem giFood = new GrocItem("Burger", fts); GrocItem giNonFood = new GrocItem("Light Bulb", fts); Assert.AreEqual(FoodType.FOOD, giFood.ItemFoodType); Assert.AreEqual(FoodType.NONFOOD, giNonFood.ItemFoodType); }
//END OF PROPERTIES public MainViewModel() { GrocList = new obsGrocList(); SelectedGrocItem = new GrocItem(); NewGrocItem = new GrocItem(); //Instanser RelayCommands AddItemCommand = new RelayCommand(AddNew, null); RemoveItemCommand = new RelayCommand(Remove, null); SaveListCommand = new RelayCommand(SaveList_Async, null); LoadListCommand = new RelayCommand(GetList_Async, null); ClearListCommand = new RelayCommand(Clear, null); }
public void testItemsEnteredOneAtATime() { CashRegister cr = new CashRegister(); GrocItem gi_one = new GrocItem("Bread"); cr.AddItem(gi_one); Assert.AreEqual(1, cr.ItemCount); GrocItem gi_two = new GrocItem("Milk"); cr.AddItem(gi_two); Assert.AreEqual(2, cr.ItemCount); }
public void testDefaultFoodType() { GrocItem gi = new GrocItem("Burger"); Assert.AreEqual(FoodType.FOOD, gi.ItemFoodType); }