public void GetBestOffers() { Assert.IsNotNull(TestData.NewItem, "Failed because no item available -- requires successful AddItem test"); // GetBestOffersCall api = new GetBestOffersCall(this.apiContext); api.ItemID = TestData.NewItem.ItemID; api.BestOfferStatus = BestOfferStatusCodeType.All; // Make API call. ApiException gotException = null; try { /* BestOfferTypeCollection offers =*/ api.Execute(); } catch(ApiException ex) { gotException = ex; } Assert.IsNotNull(gotException); }
private void BtnGetBestOffers_Click(object sender, System.EventArgs e) { try { LstBestOffers.Items.Clear(); GetBestOffersCall apicall = new GetBestOffersCall(Context); if (TxtBestOfferID.Text.Length > 0) apicall.BestOfferID = TxtBestOfferID.Text; apicall.BestOfferStatus = (BestOfferStatusCodeType) Enum.Parse(typeof(BestOfferStatusCodeType), CboFilter.SelectedItem.ToString()); apicall.DetailLevelList.Add(DetailLevelCodeType.ReturnAll); string ItemID = TxtItemID.Text; BestOfferTypeCollection bestoffers = apicall.GetBestOffers(ItemID); TxtTitle.Text = apicall.Item.Title; TxtLocation.Text = apicall.Item.Location; TxtEndTime.Text = apicall.Item.ListingDetails.EndTime.ToString(); TxtBuyItNowPrice.Text = apicall.Item.BuyItNowPrice.Value.ToString(); TxtCurrency.Text = apicall.Item.BuyItNowPrice.currencyID.ToString(); foreach (BestOfferType bestoffer in bestoffers) { string[] listparams = new string[11]; listparams[0] = bestoffer.BestOfferID; listparams[1] = bestoffer.ExpirationTime.ToString(); listparams[2] = bestoffer.Price != null ?(bestoffer.Price.Value.ToString()):""; listparams[3] = bestoffer.Status.ToString(); listparams[4] = bestoffer.Quantity.ToString(); listparams[5] = bestoffer.Buyer.FeedbackScore.ToString(); listparams[6] = bestoffer.Buyer.RegistrationDate.ToString(); listparams[7] = bestoffer.Buyer.UserID; listparams[8] = bestoffer.Buyer.Email; listparams[9] = bestoffer.BuyerMessage; listparams[10] = bestoffer.SellerMessage; ListViewItem vi = new ListViewItem(listparams); this.LstBestOffers.Items.Add(vi); } } catch (Exception ex) { MessageBox.Show(ex.Message); } }