public void testValidateInventory() { try { Inventory i = new Inventory(); i.id = 1; i.setBeefQty(50); i.setBlackBeansQty(50); i.setBrownRiceQty(50); i.setChickenQty(50); i.setChiliTortillaQty(50); i.setCucumberQty(50); i.setFlourTortillaQty(50); i.setGuacamoleQty(20); i.setHerbGarlicTortillaQty(50); i.setHummusQty(50); i.setJalapenoCheddarTortillaQty(50); i.setLettuceQty(50); i.setOnionQty(50); i.setPintoBeansQty(50); i.setSalsaPicoQty(50); i.setSalsaSpecialQty(50); i.setSalsaVerdeQty(50); i.setTomatoBasilTortillaQty(50); i.setTomatoesQty(50); i.setWheatTortillaQty(50); i.setWhiteRiceQty(50); i.setJalapenosQty(50); Assert.True(i.validate()); } catch(Exception e) { Console.WriteLine("Exception in testValidateInventory: " + e.Message + "\n" + e.StackTrace); Assert.Fail(e.Message + "\n" + e.StackTrace); } }
/// <summary> /// /// </summary> /// <param name="i"></param> /// <param name="b"></param> /// <returns></returns> public Boolean returnToInventory(Inventory i, Burrito b) { dLog.Debug("In returnToInventory"); Boolean result = false; try { if (i.validate() && b.validate()) { // add burrito ingredients to inventory if (b.Beef) i.setBeefQty(i.BeefQty + 1); if (b.Chicken) i.setChickenQty(i.ChickenQty + 1); if (b.Hummus) i.setHummusQty(i.HummusQty + 1); //calculate remaining extras if (b.ChiliTortilla) i.setChiliTortillaQty(i.ChiliTortillaQty + 1); if (b.HerbGarlicTortilla) i.setHerbGarlicTortillaQty(i.HerbGarlicTortillaQty + 1); if (b.JalapenoCheddarTortilla) i.setJalapenoCheddarTortillaQty(i.JalapenoCheddarTortillaQty + 1); if (b.TomatoBasilTortilla) i.setTomatoBasilTortillaQty(i.TomatoBasilTortillaQty + 1); if (b.WheatTortilla) i.setWheatTortillaQty(i.WheatTortillaQty + 1); if (b.FlourTortilla) i.setFlourTortillaQty(i.FlourTortillaQty + 1); if (b.WhiteRice) i.setWhiteRiceQty(i.WhiteRiceQty + 1); if (b.BrownRice) i.setBrownRiceQty(i.BrownRiceQty + 1); if (b.BlackBeans) i.setBlackBeansQty(i.BlackBeansQty + 1); if (b.PintoBeans) i.setPintoBeansQty(i.PintoBeansQty + 1); if (b.SalsaPico) i.setSalsaPicoQty(i.SalsaPicoQty + 1); if (b.SalsaSpecial) i.setSalsaSpecialQty(i.SalsaSpecialQty + 1); if (b.SalsaVerde) i.setSalsaVerdeQty(i.SalsaVerdeQty + 1); if (b.Guacamole) i.setGuacamoleQty(i.GuacamoleQty + 1); if (b.Cucumber) i.setCucumberQty(i.CucumberQty + 1); if (b.Jalapenos) i.setJalapenosQty(i.JalapenosQty + 1); if (b.Lettuce) i.setLettuceQty(i.LettuceQty + 1); if (b.Onion) i.setOnionQty(i.OnionQty + 1); if (b.Tomatoes) i.setTomatoesQty(i.TomatoesQty + 1); // ensure the inventory gets updated if (inventorySvc.storeInventory(i)) { result = true; } } } catch (Exception e) { dLog.Debug("Exception in returnToInventory: " + e.Message + "\n" + e.StackTrace); result = false; } dLog.Debug("returnToInventory result: " + result); return result; }