/// <summary> /// Deletes the order item from the order header /// If the order state is "Complete" then the button would not work /// </summary> private void BtnDelete_Click(object sender, RoutedEventArgs e) { if (currentOrderHeader.State != (int)Enum.Parse(typeof(OrderStates), "Complete")) { int itemToBeDeletedId = currentOrders.ElementAt(dgOrderItem.SelectedIndex).StockItemId; int itemToBeDeletedQuantity = currentOrders.ElementAt(dgOrderItem.SelectedIndex).Quantity; string itemToBeDeletedDescription = currentOrders.ElementAt(dgOrderItem.SelectedIndex).Description; layer.DeleteOrderItem(currentOrderHeader.Id, itemToBeDeletedId, itemToBeDeletedQuantity, itemToBeDeletedDescription); UpdateInfo(); } }
public void TestTwo() { bool itemExists = false; layer.DeleteOrderItem(orderHeaderId, idOfStockItemTested, quantityOfStockItemTested, "In_stock"); try { layer.ProcessOrder(orderHeaderId).ElementAt(0); itemExists = true; } catch (Exception) { }; Assert.AreEqual(itemExists, false); }