Esempio n. 1
0
        private void BtnGetCrossPromotions_Click(object sender, System.EventArgs e)
        {
            try
            {
                LstCrossPromotions.Items.Clear();
                GetCrossPromotionsCall apicall = new GetCrossPromotionsCall(Context);
                apicall.PromotionViewMode = (TradingRoleCodeType)Enum.Parse(typeof(TradingRoleCodeType), CboViewMode.SelectedItem.ToString());
                CrossPromotionsType promotions = apicall.GetCrossPromotions(TxtItemId.Text, (PromotionMethodCodeType)Enum.Parse(typeof(PromotionMethodCodeType), CboMethod.SelectedItem.ToString()));


                foreach (PromotedItemType promo in promotions.PromotedItem)
                {
                    string[] listparams = new string[5];
                    listparams[0] = promo.ItemID;
                    listparams[1] = promo.Title;
                    listparams[3] = promo.ListingType.ToString();

                    ListViewItem vi = new ListViewItem(listparams);
                    LstCrossPromotions.Items.Add(vi);
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
        public void GetCrossPromotions()
        {
            Assert.IsNotNull(TestData.NewItem, "Failed because no item available -- requires successful AddItem test");
            GetCrossPromotionsCall api = new GetCrossPromotionsCall(this.apiContext);

            api.ItemID            = TestData.NewItem.ItemID;
            api.PromotionMethod   = PromotionMethodCodeType.CrossSell;
            api.PromotionViewMode = TradingRoleCodeType.Seller;
            // Make API call.
            api.Execute();
            CrossPromotionsType cr = api.ApiResponse.CrossPromotion;
        }
        public void GetCrossPromotionsFull()
        {
            Assert.IsNotNull(TestData.NewItem2, "Failed because no item available -- requires successful AddItem test");
            GetCrossPromotionsCall api = new GetCrossPromotionsCall(this.apiContext);

            api.ItemID            = TestData.NewItem2.ItemID;
            api.PromotionMethod   = PromotionMethodCodeType.CrossSell;
            api.PromotionViewMode = TradingRoleCodeType.Seller;
            // Make API call.
            api.Execute();
            //check whether the call is success.
            Assert.IsTrue(api.ApiResponse.Ack == AckCodeType.Success || api.ApiResponse.Ack == AckCodeType.Warning, "do not success!");
            CrossPromotionsType cr = api.ApiResponse.CrossPromotion;

            Assert.IsNotNull(cr);

            //the following item could not be null
            Assert.IsNotNull(cr.ItemID);
            if (cr.PromotedItem != null && cr.PromotedItem.Count > 0)
            {
                Assert.IsNotNull(cr.PromotedItem[0].ListingType);
                Assert.IsNotNull(cr.PromotedItem[0].Position);
                Assert.IsNotNull(cr.PromotedItem[0].PromotionDetails);
                if (cr.PromotedItem[0].PromotionDetails.Count > 0)
                {
                    Assert.IsNotNull(cr.PromotedItem[0].PromotionDetails[0].PromotionPrice);
                    Assert.IsNotNull(cr.PromotedItem[0].PromotionDetails[0].PromotionPriceType);
                }
                Assert.IsNotNull(cr.PromotedItem[0].SelectionType);
                Assert.IsNotNull(cr.PromotedItem[0].TimeLeft);
                Assert.IsNotNull(cr.PromotedItem[0].Title);
            }
            Assert.IsNotNull(cr.PromotionMethod);
            Assert.IsNotNull(cr.SellerID);
            Assert.IsNotNull(cr.ShippingDiscount);
        }