Example #1
0
        /// <summary>
        /// call GetCategories to get all categories for a given site
        /// </summary>
        /// <returns>generic object</returns>
        protected override object callApi()
        {
            GetCategoryFeaturesCall api = new GetCategoryFeaturesCall(context);
            //set detail level
            api.DetailLevelList.Add(DetailLevelCodeType.ReturnAll);
            FeatureIDCodeTypeCollection featureCol = new FeatureIDCodeTypeCollection();
            featureCol.Add(FeatureIDCodeType.ListingDurations);
            featureCol.Add(FeatureIDCodeType.ItemSpecificsEnabled);
            featureCol.Add(FeatureIDCodeType.ReturnPolicyEnabled);
            featureCol.Add(FeatureIDCodeType.PaymentMethods);
            //execute call
            api.FeatureIDList = featureCol;
            api.GetCategoryFeatures();

            return api.ApiResponse;
        }
Example #2
0
        /// <summary>
        /// get some items which supports the ad format category, you can specify the number
        /// </summary>
        /// <param name="apiContext"></param>
        /// <param name="num"></param>
        /// <param name="categoryTypeCollection"></param>
        /// <param name="message"></param>
        /// <returns></returns>
        public static bool GetAdFormatCategory(ApiContext apiContext, int num, out CategoryTypeCollection categoryTypeCollection, out string message)
        {
            message = string.Empty;
            CategoryTypeCollection tmpCategories;

            categoryTypeCollection = null;
            num = (num <= 0)?1:num;

            GetCategoryFeaturesCall api = new GetCategoryFeaturesCall(apiContext);

            setBasicInfo(ref api);
            //spcify category id
            if (!getAllCategories(apiContext, out tmpCategories, out message))
            {
                message = message + ",203";
                return(false);
            }

            FeatureIDCodeTypeCollection features = new FeatureIDCodeTypeCollection();
            FeatureIDCodeType           type     = FeatureIDCodeType.AdFormatEnabled;

            features.Add(type);

            string categoryID = string.Empty;

            foreach (CategoryType category in tmpCategories)
            {
                if (category.LeafCategory == true)
                {
                    categoryID = category.CategoryID;
                    try
                    {
                        //call
                        CategoryFeatureTypeCollection featureTypes = api.GetCategoryFeatures(categoryID, 10, true, features, true);

                        if (featureTypes != null && featureTypes.Count > 0)
                        {
                            if (featureTypes[0].AdFormatEnabled == AdFormatEnabledCodeType.Enabled)
                            {
                                categoryTypeCollection.Add(category);
                            }

                            if (categoryTypeCollection.Count >= num)
                            {
                                break;
                            }
                        }
                    }
                    catch (Exception e)
                    {
                        message = e.Message + ",204";
                        return(false);
                    }
                }
            }

            return(true);
        }
        public void AddItemFull()
        {
            if (TestData.NewItem2 != null)
            {
                (new T_120_EndItemLibrary()).EndItemFull();
                TestData.NewItem2 = null;
            }

            bool     isSucess, isSupport = true;
            string   message;
            ItemType item = ItemHelper.BuildItem();

            item.PrimaryCategory.CategoryID = CATEGORYID.ToString();
            //add Item AttributeSetArray
            //AttributeSetTypeCollection attributeSAT=GetAttributeSetCol(CATEGORYID,apiContext);
            //item.AttributeSetArray=attributeSAT;

            //check this category is custom specifics support
            FeatureIDCodeTypeCollection features = new FeatureIDCodeTypeCollection();
            FeatureIDCodeType           feature  = FeatureIDCodeType.ItemSpecificsEnabled;

            features.Add(feature);
            isSucess = UnitTests.Helper.CategoryHelper.IsSupportFeature(CATEGORYID, features, apiContext, out isSupport, out message);
            System.Console.WriteLine(message);
            Assert.IsTrue(isSucess, "there are some errors during checkging the CategoryFeatures");
            Assert.IsTrue(isSupport, "this category 104970 do not support the custom item specified any more!");
            //add CIS
            item.ItemSpecifics = getCIS();

            FeeTypeCollection fees;

            VerifyAddItemCall vi = new VerifyAddItemCall(apiContext);

            fees = vi.VerifyAddItem(item);
            Assert.IsNotNull(fees);

            AddItemCall addItemCall = new AddItemCall(apiContext);;

            fees = addItemCall.AddItem(item);
            //check whether the call is success.
            Assert.IsTrue(addItemCall.AbstractResponse.Ack == AckCodeType.Success || addItemCall.AbstractResponse.Ack == AckCodeType.Warning, "do not success!");
            Assert.IsNotNull(fees);
            // Save the result.
            TestData.NewItem2 = item;
        }
Example #4
0
        public static bool GetCISSupportLeafCategory(int number, out CategoryTypeCollection categories, ApiContext apiContext, out string message)
        {
            CategoryTypeCollection categoryTypeCollection;

            categories = new CategoryTypeCollection();
            bool isSuccess, isSupport;

            if (number <= 0)
            {
                number = 1;
            }

            if (getAllCategories(apiContext, out categoryTypeCollection, out message))
            {
                foreach (CategoryType category in categoryTypeCollection)
                {
                    if (category.LeafCategory == true)
                    {
                        //check whether the category support the ItemSpecificsEnabled;
                        FeatureIDCodeTypeCollection features = new FeatureIDCodeTypeCollection();
                        FeatureIDCodeType           type     = FeatureIDCodeType.ItemSpecificsEnabled;
                        features.Add(type);
                        isSuccess = isSupportFeature(int.Parse(category.CategoryID), features, apiContext, out isSupport, out message);
                        if (!isSuccess)
                        {
                            return(false);
                        }

                        if (isSupport)
                        {
                            categories.Add(category);

                            if (categories.Count == number)
                            {
                                break;
                            }
                        }
                    }            //end if
                }                //end foreach

                return(true);
            }

            return(false);
        }
Example #5
0
        public void GetCategoryFeaturesFull2()
        {
            GetCategoryFeaturesCall api = new GetCategoryFeaturesCall(this.apiContext);

            DetailLevelCodeType[] detailLevels = new DetailLevelCodeType[] {
                DetailLevelCodeType.ReturnAll
            };
            api.DetailLevelList = new DetailLevelCodeTypeCollection(detailLevels);
            FeatureIDCodeTypeCollection features = new FeatureIDCodeTypeCollection();
            FeatureIDCodeType           feature  = FeatureIDCodeType.BestOfferEnabled;

            features.Add(feature);
            api.FeatureIDList = features;
            api.CategoryID    = COOKBOOKSCATEGORYID;
            api.Execute();
            //check whether the call is success.
            Assert.IsTrue(api.ApiResponse.Ack == AckCodeType.Success || api.ApiResponse.Ack == AckCodeType.Warning, "the call is failure!");
            Assert.IsNotNull(api.ApiResponse.FeatureDefinitions);
            Assert.AreEqual(api.ApiResponse.Category[0].CategoryID, COOKBOOKSCATEGORYID);
        }
        /// <summary>
        /// call GetCategories to get all categories for a given site
        /// </summary>
        /// <returns>generic object</returns>
        protected override object callApi()
        {
            GetCategoryFeaturesCall api = new GetCategoryFeaturesCall(context);

            //set detail level
            api.DetailLevelList.Add(DetailLevelCodeType.ReturnAll);
            api.ViewAllNodes = true;
            FeatureIDCodeTypeCollection featureCol = new FeatureIDCodeTypeCollection();

            featureCol.Add(FeatureIDCodeType.ListingDurations);
            featureCol.Add(FeatureIDCodeType.ItemSpecificsEnabled);
            featureCol.Add(FeatureIDCodeType.ReturnPolicyEnabled);
            featureCol.Add(FeatureIDCodeType.PaymentMethods);
            featureCol.Add(FeatureIDCodeType.ConditionEnabled);
            featureCol.Add(FeatureIDCodeType.ConditionValues);
            //execute call
            api.FeatureIDList = featureCol;
            api.GetCategoryFeatures();

            return(api.ApiResponse);
        }
		/// <summary>
		/// get some items which supports the ad format category, you can specify the number
		/// </summary>
		/// <param name="apiContext"></param>
		/// <param name="num"></param>
		/// <param name="categoryTypeCollection"></param>
		/// <param name="message"></param>
		/// <returns></returns>
		public static  bool GetAdFormatCategory(ApiContext apiContext,int num,out CategoryTypeCollection categoryTypeCollection,out string message)
		{
			message=string.Empty;
			CategoryTypeCollection tmpCategories;
			categoryTypeCollection = null;
			num=(num<=0)?1:num;

			GetCategoryFeaturesCall api = new GetCategoryFeaturesCall(apiContext);
			setBasicInfo(ref api);
			//spcify category id
			if(!getAllCategories(apiContext,out tmpCategories, out message))
			{
				message=message+",203";
				return false;
			}
			
			FeatureIDCodeTypeCollection features=new FeatureIDCodeTypeCollection();
			FeatureIDCodeType type=FeatureIDCodeType.AdFormatEnabled;
			features.Add(type);

			string categoryID=string.Empty;

			foreach(CategoryType category in tmpCategories)
			{
				if(category.LeafCategory == true)
				{
					categoryID=category.CategoryID;
					try
					{
						//call
						CategoryFeatureTypeCollection featureTypes = api.GetCategoryFeatures(categoryID,10,true,features,true);
					
						if(featureTypes!=null&&featureTypes.Count>0)
						{
							if(featureTypes[0].AdFormatEnabled==AdFormatEnabledCodeType.Enabled)
							{
								categoryTypeCollection.Add(category);
							}

							if(categoryTypeCollection.Count>=num)
							{
								break;
							}
						}

					}
					catch(Exception e)
					{
						message=e.Message+",204";
						return false;
					}
				}	
			}
			
			return true;
		}
		public static bool GetCISSupportLeafCategory(int number,out CategoryTypeCollection categories,ApiContext apiContext,out string message)
		{
			CategoryTypeCollection categoryTypeCollection;
			categories=new CategoryTypeCollection();
			bool isSuccess,isSupport;
			if(number<=0)
			{
				number=1;
			}

			if(getAllCategories(apiContext,out categoryTypeCollection,out message))
			{
				foreach(CategoryType category in categoryTypeCollection)
				{
					if(category.LeafCategory==true)
					{
						//check whether the category support the ItemSpecificsEnabled;
						FeatureIDCodeTypeCollection features=new FeatureIDCodeTypeCollection();
						FeatureIDCodeType type=FeatureIDCodeType.ItemSpecificsEnabled;
						features.Add(type);
						isSuccess=isSupportFeature(int.Parse(category.CategoryID),features,apiContext,out isSupport,out message);
						if(!isSuccess)
						{
							return false;
						}
						
						if(isSupport)
						{
							categories.Add(category);

							if(categories.Count==number)
							{
								break;
							}
						}
					}//end if
				}//end foreach

				return true;
			}

			return false;
		}
Example #9
0
        public void AddItemFull()
        {
            if( TestData.NewItem2 != null )
            {
                (new T_120_EndItemLibrary()).EndItemFull();
                TestData.NewItem2 = null;
            }

            bool isSucess,isSupport;
            string message;
            ItemType item= ItemHelper.BuildItem();
            item.PrimaryCategory.CategoryID=CATEGORYID.ToString();
            //add Item AttributeSetArray
            AttributeSetTypeCollection attributeSAT=GetAttributeSetCol(CATEGORYID,apiContext);
            item.AttributeSetArray=attributeSAT;

            //check this category is custom specifics support
            FeatureIDCodeTypeCollection features=new FeatureIDCodeTypeCollection();
            FeatureIDCodeType feature=FeatureIDCodeType.ItemSpecificsEnabled;
            features.Add(feature);
            isSucess=UnitTests.Helper.CategoryHelper.IsSupportFeature(CATEGORYID,features,apiContext,out isSupport,out message);
            Assert.IsTrue(isSucess,"there are some errors during checkging the CategoryFeatures");
            Assert.IsTrue(isSupport,"this category 50253 do not support the custom item specified any more!");
            //add CIS
            item.ItemSpecifics = getCIS();

            FeeTypeCollection fees;

            VerifyAddItemCall vi = new VerifyAddItemCall(apiContext);
            fees = vi.VerifyAddItem(item);
            Assert.IsNotNull(fees);

            AddItemCall addItemCall = new AddItemCall(apiContext);;
            fees = addItemCall.AddItem(item);
            //check whether the call is success.
            Assert.IsTrue(addItemCall.AbstractResponse.Ack==AckCodeType.Success || addItemCall.AbstractResponse.Ack==AckCodeType.Warning,"do not success!");
            Assert.IsNotNull(fees);
            // Save the result.
            TestData.NewItem2 = item;
        }
 public void GetCategoryFeaturesFull2()
 {
     GetCategoryFeaturesCall api = new GetCategoryFeaturesCall(this.apiContext);
     DetailLevelCodeType[] detailLevels = new DetailLevelCodeType[] {
     DetailLevelCodeType.ReturnAll
     };
     api.DetailLevelList = new DetailLevelCodeTypeCollection(detailLevels);
     FeatureIDCodeTypeCollection features=new FeatureIDCodeTypeCollection();
     FeatureIDCodeType feature=FeatureIDCodeType.BestOfferEnabled;
     features.Add(feature);
     api.FeatureIDList=features;
     api.CategoryID=COOKBOOKSCATEGORYID;
     api.Execute();
     //check whether the call is success.
     Assert.IsTrue(api.ApiResponse.Ack == AckCodeType.Success || api.ApiResponse.Ack == AckCodeType.Warning,"the call is failure!");
     Assert.IsNotNull(api.ApiResponse.FeatureDefinitions);
     Assert.AreEqual(api.ApiResponse.Category[0].CategoryID,COOKBOOKSCATEGORYID);
 }