コード例 #1
0
        public void testStoreInventory()
        {
            try {
                //week 3
                //IInventorySvc ics = factory.getInventorySvc();

                //week 4
                IInventorySvc ics = (IInventorySvc)factory.getService("IInventorySvc");

                // First let's store the Inventory
                Assert.True(ics.storeInventory(i));

                // Then let's read it back in
                i = ics.getInventory(i.id);
                Assert.True(i.validate());

                // Update Inventory
                i.BlackBeansQty = 3;
                i.CucumberQty   = 17;
                i.SalsaVerdeQty = 12;
                Assert.True(ics.storeInventory(i));

                // Finally, let's cleanup the file that was created
                Assert.True(ics.deleteInventory(i.id));
            }
            catch (Exception e) {
                Console.WriteLine("Exception in testStoreInventory: " + e.Message + "\n" + e.StackTrace);
                Assert.Fail(e.Message + "\n" + e.StackTrace);
            }
        }
コード例 #2
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        public Inventory getInventory(Int32 id)
        {
            dLog.Debug("In getInventory");
            Inventory result;

            try
            {
                result = inventorySvc.getInventory(id);
            }
            catch (Exception e)
            {
                dLog.Debug("Exception in getInventory: " + e.Message + "\n" + e.StackTrace);
                result = null;
            }

            dLog.Debug("getInventory result: " + result);
            return(result);
        }