public void testStoreOrder() { try { //week 3 //IOrderSvc ics = factory.getOrderSvc(); //week 4 IOrderSvc ics = (IOrderSvc)factory.getService("IOrderSvc"); // First let's store the Order Assert.True(ics.storeOrder(o)); // Then let's read it back in o = ics.getOrder(o.id); Assert.True(o.validate()); // Update the Order o.isComplete = true; o.isSubmitted = true; Assert.True(ics.storeOrder(o)); // Finally, let's cleanup the file that was created Assert.True(ics.deleteOrder(o.id)); } catch (Exception e) { Console.WriteLine("Exception in testStoreOrder: " + e.Message + "\n" + e.StackTrace); Assert.Fail(e.Message + "\n" + e.StackTrace); } }
/// <summary> /// /// </summary> /// <param name="o"></param> /// <returns></returns> public Boolean deleteOrder(Order o) { dLog.Debug("In deleteOrder"); Boolean result = false; try { if (o.validate()) { if (orderSvc.deleteOrder(o.id)) { result = true; } } } catch (Exception e) { dLog.Debug("Exception in deleteOrder: " + e.Message + "\n" + e.StackTrace); result = false; } dLog.Debug("deleteOrder result: " + result); return(result); }