public void testCustomerSvc() { try { //week 3 //ICustomerSvc ics = factory.getCustomerSvc(); //week 4 ICustomerSvc ics = (ICustomerSvc)factory.getService("ICustomerSvc"); // First let's store the Customer Assert.True(ics.storeCustomer(c)); // Then let's read it back in c = ics.getCustomer(c.id); Assert.True(c.validate()); // Update customer c.emailAddress = "*****@*****.**"; Assert.True(ics.storeCustomer(c)); // Finally, let's cleanup the file that was created Assert.True(ics.deleteCustomer(c.id)); } catch (Exception e) { Console.WriteLine("Exception in testStoreCustomer: " + e.Message + "\n" + e.StackTrace); Assert.Fail(e.Message + "\n" + e.StackTrace); } }
public void testInvalidGetCustomer() { try { //week 3 //ICustomerSvc ics = factory.getCustomerSvc(); //week 4 ICustomerSvc ics = (ICustomerSvc)factory.getService("ICustomerSvc"); c = ics.getCustomer(1234); if (c != null) { Assert.False(c.validate()); } } catch (Exception e) { Console.WriteLine("Exception in testInvalidGetCustomer: " + e.Message + "\n" + e.StackTrace); Assert.Fail(e.Message + "\n" + e.StackTrace); } }