public void Run() { Console.WriteLine("Start"); Inventory inventory = new Inventory(); Item item1 = new Item("1", NB1); Item item2 = new Item("2", NB2); Item item3 = new Item("3", NB3); inventory.addItem(item1); inventory.addItem(item2); inventory.addItem(item3); ShoppingCart sc = new ShoppingCart(); ShoppingCartOperator.addShoppingCartItem(sc, inventory, item1); ShoppingCartOperator.addShoppingCartItem(sc, inventory, item2); try { ShoppingCartOperator.addShoppingCartItem(sc, inventory, item3); } catch { // C'est juste pour tester la remontée d'exception Console.WriteLine(""); } Console.WriteLine("End"); }
/** * For the Sample * @param pSc For the Sample * @param pInventory For the Sample * @param pItem For the Sample */ public static void removeShoppingCartItem(ShoppingCart pSc, Inventory pInventory, Item pItem) { try { Thread.Sleep(TEMPO2); } catch (ThreadInterruptedException e) { // @todo Auto-generated catch block e.StackTrace.ToString(); } pSc.removeItem(pItem); pInventory.addItem(pItem); }