public void GetPromotionRules() { GetPromotionRulesCall api = new GetPromotionRulesCall(this.apiContext); api.PromotionMethod = PromotionMethodCodeType.CrossSell; api.StoreCategoryID = 1; // Make API call. PromotionRuleTypeCollection rules = api.GetPromotionRules(api.ItemID, api.PromotionMethod); // Verify the result. Assert.IsNotNull(rules); }
public void GetPromotionRulesFull() { bool isTherePropertyNull; int nullPropertyNums; string nullPropertyNames; Assert.IsNotNull(TestData.NewItem2, "Failed because no item available -- requires successful AddItem test"); GetPromotionRulesCall api = new GetPromotionRulesCall(this.apiContext); string itemID = TestData.NewItem2.ItemID; PromotionMethodCodeType promotionType= PromotionMethodCodeType.UpSell; PromotionRuleTypeCollection rules = api.GetPromotionRules(itemID,promotionType); //check whether the call is success. Assert.IsTrue(api.ApiResponse.Ack==AckCodeType.Success || api.ApiResponse.Ack==AckCodeType.Warning,"do not success!"); Assert.IsNotNull(rules); if(rules!=null && rules.Count>0) { isTherePropertyNull=ReflectHelper.IsProperteValueNotNull(rules[0],out nullPropertyNums,out nullPropertyNames); Assert.IsTrue(isTherePropertyNull,"there are" +nullPropertyNums.ToString()+ " properties(" +nullPropertyNames+ ")value is null"); } }
private void BtnGetPromotionRules_Click(object sender, System.EventArgs e) { try { LstCrossPromotions.Items.Clear(); GetPromotionRulesCall apicall = new GetPromotionRulesCall(Context); if (TxtItemId.Text != String.Empty) { apicall.GetPromotionRules(TxtItemId.Text, (PromotionMethodCodeType) Enum.Parse(typeof(PromotionMethodCodeType), CboMethod.SelectedItem.ToString())); } else { apicall.GetPromotionRules(Convert.ToInt32(TxtStoreCat.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[2] = promo.PromotionPrice.Value.ToString(); // listparams[3] = promo.PromotionPriceType.ToString(); // listparams[4] = promo.ListingType.ToString(); // // ListViewItem vi = new ListViewItem(listparams); // LstCrossPromotions.Items.Add(vi); // // } } catch (Exception ex) { MessageBox.Show(ex.Message); } }