public void ReviseItem() { ItemType itemTest = TestData.NewItem; Assert.IsNotNull(itemTest); // ReviseItemCall rviCall = new ReviseItemCall(this.apiContext); ItemType item = new ItemType(); item.ItemID = itemTest.ItemID; item.StartPrice = new AmountType(); item.StartPrice.Value = 2.89; item.StartPrice.currencyID = CurrencyCodeType.USD; rviCall.Item = item; //verify fisrt rviCall.VerifyOnly = true; rviCall.Execute(); FeeTypeCollection fees = rviCall.FeeList; //check whether the call is success. Assert.IsTrue(rviCall.AbstractResponse.Ack == AckCodeType.Success || rviCall.AbstractResponse.Ack == AckCodeType.Warning, "do not success!"); // Call GetItem and then compare the startPrice. GetItemCall getItem1 = new GetItemCall(this.apiContext); DetailLevelCodeType[] detailLevels1 = new DetailLevelCodeType[] { DetailLevelCodeType.ReturnAll }; getItem1.DetailLevelList = new DetailLevelCodeTypeCollection(detailLevels1); ItemType returnedItem1 = getItem1.GetItem(itemTest.ItemID); Assert.AreNotEqual(returnedItem1.StartPrice.Value, item.StartPrice.Value); //revise rviCall.VerifyOnly = false; rviCall.Execute(); // Let's wait for the server to "digest" the data. System.Threading.Thread.Sleep(1000); //check whether the call is success. Assert.IsTrue(rviCall.AbstractResponse.Ack==AckCodeType.Success || rviCall.AbstractResponse.Ack==AckCodeType.Warning,"do not success!"); // Call GetItem and then compare the startPrice. GetItemCall getItem2 = new GetItemCall(this.apiContext); DetailLevelCodeType[] detailLevels2 = new DetailLevelCodeType[] { DetailLevelCodeType.ReturnAll }; getItem2.DetailLevelList = new DetailLevelCodeTypeCollection(detailLevels2); ItemType returnedItem2 = getItem2.GetItem(itemTest.ItemID); Assert.AreEqual(returnedItem2.StartPrice.Value, item.StartPrice.Value); // Update itemTest. TestData.NewItem = returnedItem2; }
/// <summary> /// revise an item /// </summary> /// <param name="itemId"></param> /// <param name="metrics"></param> public static void ReviseItem(ItemType item, CallMetricsTable metrics) { Debug.Assert(item != null); Debug.Assert(item.ItemID != null); Debug.Assert(item.ItemID.Length > 0); try { ApiContext ctx = GetContext(); ctx.EnableMetrics = true; ctx.CallMetricsTable = metrics; ReviseItemCall call = new ReviseItemCall(ctx); call.Site = SiteCodeType.US; ItemType itemToBeRevised = new ItemType(); itemToBeRevised.ItemID = item.ItemID; call.Item=itemToBeRevised; itemToBeRevised.Description="Item has been modified!"; call.Execute(); } catch (Exception e) { if(item==null) { ShowException("ReviseItem(null)", e); } else { ShowException("ReviseItem(" + item.ItemID + ")", e); } } }
public void ReviseItemFull() { bool isSuccess; string message; ItemType item = TestData.NewItem2,itemOut; Assert.IsNotNull(item); ReviseItemCall rviCall = new ReviseItemCall(this.apiContext); StringCollection stringCol=new StringCollection(); stringCol.Add("item.ApplicationData"); rviCall.DeletedFieldList=stringCol; item.StartPrice = new AmountType(); item.StartPrice.Value = 2.89; item.StartPrice.currencyID = CurrencyCodeType.USD; rviCall.Item = item; rviCall.Execute(); // Let's wait for the server to "digest" the data. System.Threading.Thread.Sleep(1000); isSuccess=ItemHelper.GetItem(item,this.apiContext,out message,out itemOut); Assert.IsTrue(isSuccess,message); Assert.IsTrue(message==string.Empty,message); Assert.IsNull(itemOut.ApplicationData); Assert.AreEqual(itemOut.StartPrice.Value,item.StartPrice.Value); }