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 createOrder(Order o) { dLog.Debug("In createOrder"); Boolean result = false; try { dLog.Debug("Validating order object"); if (o.validate()) { if (orderSvc.storeOrder(o)) { result = true; } } } catch (Exception e) { dLog.Debug("Exception in createOrder: " + e.Message + "\n" + e.StackTrace); result = false; } dLog.Debug("createOrder result: " + result); return(result); }