当前位置: 首页>>代码示例>>C#>>正文


C# Categories.Add方法代码示例

本文整理汇总了C#中Categories.Add方法的典型用法代码示例。如果您正苦于以下问题:C# Categories.Add方法的具体用法?C# Categories.Add怎么用?C# Categories.Add使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Categories的用法示例。


在下文中一共展示了Categories.Add方法的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Excluded

 private bool Excluded(ITestMethodInfo testMethod) {
    if(_excludedCategories.IsEmpty) {
       return false;
    }
    var local = new Categories();
    local.Add(testMethod.Categories);
    local.Add(testMethod.InheritedCategories);
    return local.Intersect(_excludedCategories).Count > 0;
 }
开发者ID:ManfredLange,项目名称:csUnit,代码行数:9,代码来源:CategorySelector.cs

示例2: GetCategory

        public Categories GetCategory(string[] ids, int ipage)
        {
            if (ids == null || ids.Length == 0)
                return new Categories();

            if (IdCateDic.Count == 0)
            {
                TryToLoadCategoriesDicFromFile();
            }

            if (IdCateDic.ContainsKey(ids[0]))
            {
                Categories categories = new Categories();
                foreach (var id in ids)
                {
                    categories.Add(IdCateDic[id]);
                }
                return categories;
            }
            else
            {
                return GetCategoryFromNetwork(ids, ipage);
            }
        }
开发者ID:jimji2008,项目名称:ProcutVS,代码行数:24,代码来源:Server.cs

示例3: ExcludedSurvivesRefresh

 public void ExcludedSurvivesRefresh() {
    RecipeFactory.Type = typeof(ASpecialRecipe);
    RecipeFactory.NewRecipe(string.Empty);
    _fc.ResetAllCategories();
    _fc.ExcludeCategory("Blue");
    _fc.RefreshCategoriesList();
    var expected = new Categories();
    expected.Add("Blue");
    Assert.Equals(expected, _fc.ExcludedCategories);
 }
开发者ID:ManfredLange,项目名称:csUnit,代码行数:10,代码来源:CategoryControlTests.cs

示例4: IsIncluded

 private bool IsIncluded(ITestFixture testFixture) {
    if(   _includedCategories.IsEmpty
       || (testFixture.Categories.IsEmpty
       && testFixture.InheritedCategories.IsEmpty) ) {
       return true;
    }
    var local = new Categories();
    local.Add(testFixture.Categories);
    local.Add(testFixture.InheritedCategories);
    return local.Intersect(_includedCategories).Count > 0;
 }
开发者ID:ManfredLange,项目名称:csUnit,代码行数:11,代码来源:CategorySelector.cs

示例5: DeserializeCategories

 private static void DeserializeCategories(XmlNode doc, string categoriesGroupName,
    Categories categoriesCollection) {
    var includedCatNodes = doc.SelectNodes("categorySelector/" + categoriesGroupName + "/category");
    foreach(XmlElement elem in includedCatNodes) {
       categoriesCollection.Add(elem.InnerText);
    }
 }
开发者ID:ManfredLange,项目名称:csUnit,代码行数:7,代码来源:CategorySelector.cs

示例6: StringsTrimmedWhenArrayAdded

 public void StringsTrimmedWhenArrayAdded() {
    var strings = new[] { " blue ", " green " };
    var cats = new Categories();
    cats.Add(strings);
    Assert.Equals(2, cats.Count);
    Assert.Contains("blue", cats.ToArray());
    Assert.DoesNotContain(" blue ", cats.ToArray());
    Assert.Contains("green", cats.ToArray());
    Assert.DoesNotContain(" green ", cats.ToArray());
 }
开发者ID:ManfredLange,项目名称:csUnit,代码行数:10,代码来源:CategoriesTests.cs

示例7: Main

        static void Main(string[] args) {
            var osInfo = System.Environment.OSVersion;
            Settings.Load(Toolkit.CurrentDirectory.FindPrecedingFile("settings.json").FullPath);
            var pwd = Settings.Passcode;

            var dbcfg = Settings.Databases["default"];


            var cats = new Categories().Select();
            var parents = new Categories().Where(new { ParentID = DBNull.Value });
            var productData = Util.IO.File.ReadText("C:\\Work\\products.json");
            var products = AOI.Util.Codecs.JSON.Decode<List<Dictionary<string, dynamic>>>(productData);
            foreach (var product in products) {
                var productCategory = ((string)product["category"]).ToUpper();
                var parts = productCategory.Split('/');
                var parentCategory = parts[0];
                var pc = parents.Where(c => c.Label.ToUpper() == parentCategory).FirstOrDefault();
                if (pc == null) {
                    pc = new Categories().Single(new { Label = productCategory });
                    if (pc == null) {
                        pc = new Categories().Add(new {
                            Label = parentCategory
                        });
                        parents.Add(pc);
                    }
                }

                if (parts.Length > 1) {
                    var childCategory = parts[1];
                    var child = pc.Child(childCategory, true);
                    product["category_id"] = child.ID;
                } else {
                    product["category_id"] = pc.ID;
                }

                var description = product["description"];
                description = Util.Toolkit.UrlDecode(description);
                var url = product["picture"];
                
                //var data = Util.Http.GET(url);
                //Util.IO.File.WriteBinary("C:\\Work\\product.jpg", data);
                //product["picture_snapshot"] = data;
            }


            Log.Trace("...");
            
            //new Categories().Fetch(
            //    new {
            //        ParentID = 1
            //    }
            //);

            //var filtered = new Categories().Where(new {
            //    ParentID = 2
            //});

            //var categories = new Categories().Select();
            //var category = categories[0];
            //var childrens = category.Children;
            ////category.Update(new {
            ////    Description = "This is a category."
            //// });

            //var child = category.Create("MIRRORS");
            //var children = category.Children;


            var db = AOI.Data.Database.Open("DefaultConnection");
            //db.Insert(new Query("INSERT INTO categories (label, ParentID) VALUES (@label, @ParentID);").Set("Label", "ACCESSORIES").Set("ParentID", 2));

            //var people = db.SelectRecords<Person>("SELECT applicant_transaction_number as ID, first_name as FirstName, last_name as LastName FROM \"Applicants\" LIMIT 10;");
            //var records = db.SelectRecords("SELECT first_name as FirstName, last_name as LastName FROM \"Applicants\" LIMIT 10;");
            //var records = db.SelectRecords("SELECT * FROM \"Applicants\";");
            
            //db.Insert(new Query("INSERT INTO categories (label) VALUES (@label);").Set("Label", "ACCESSORIES"));
            //db.Insert(new Query("INSERT INTO categories (label) VALUES (@label);").Set("Label", "ARCHITECTURAL"));
            //db.Insert(new Query("INSERT INTO categories (label) VALUES (@label);").Set("Label", "FURNISHINGS"));
            //db.Insert(new Query("INSERT INTO categories (label) VALUES (@label);").Set("Label", "TEXTILES"));

            var records = db.SelectRecords<Category>("SELECT * FROM Categories;");
            Console.WriteLine("...");
        }
开发者ID:MagicWishMonkey,项目名称:aoi.net,代码行数:83,代码来源:Program.cs

示例8: RemoveFiresOnlyWhenCatRemoved

 public void RemoveFiresOnlyWhenCatRemoved() {
    var eventListener = new ModifiedListener();
    var cats = new Categories();
    cats.Modified += eventListener.OnModified;
    cats.Add("blue");
    cats.Remove("red");
    Assert.Equals(1, eventListener.EventCount, "Modified event wasn't fired.");
 }
开发者ID:ManfredLange,项目名称:csUnit,代码行数:8,代码来源:CategoriesTests.cs

示例9: AddedStringIsTrimmed

 public void AddedStringIsTrimmed() {
    var cats = new Categories();
    cats.Add(" blue ");
    Assert.Equals(1, cats.Count);
    Assert.Contains("blue", cats.ToArray());
    Assert.DoesNotContain(" blue ", cats.ToArray());
 }
开发者ID:ManfredLange,项目名称:csUnit,代码行数:7,代码来源:CategoriesTests.cs

示例10: ClearOnNonEmptyFiresModifiedEvent

 public void ClearOnNonEmptyFiresModifiedEvent() {
    var eventListener = new ModifiedListener();
    var cats = new Categories();
    cats.Modified += eventListener.OnModified;
    cats.Add("bla");
    cats.Clear();
    Assert.Equals(2, eventListener.EventCount, "Modified event wasn't fired.");
 }
开发者ID:ManfredLange,项目名称:csUnit,代码行数:8,代码来源:CategoriesTests.cs

示例11: AddCategoriesFiresModifiedEvent

 public void AddCategoriesFiresModifiedEvent() {
    var eventListener = new ModifiedListener();
    var cats = new Categories();
    cats.Modified += eventListener.OnModified;
    var otherCats = new Categories();
    otherCats.Add(new[] { "red", "green", "blue" });
    cats.Add(otherCats);
    Assert.Equals(1, eventListener.EventCount, "Modified event wasn't fired.");
 }
开发者ID:ManfredLange,项目名称:csUnit,代码行数:9,代码来源:CategoriesTests.cs

示例12: AddStringArrayFiresOnceOnly

 public void AddStringArrayFiresOnceOnly() {
    var eventListener = new ModifiedListener();
    var cats = new Categories();
    cats.Modified += eventListener.OnModified;
    cats.Add(new[] { "red", "green", "blue" });
    Assert.Equals(1, eventListener.EventCount, "Modified event wasn't fired.");
 }
开发者ID:ManfredLange,项目名称:csUnit,代码行数:7,代码来源:CategoriesTests.cs

示例13: AddFiresModifiedEventOnlyIfSomethingHasBeenAdded

 public void AddFiresModifiedEventOnlyIfSomethingHasBeenAdded() {
    var eventListener = new ModifiedListener();
    var cats = new Categories();
    cats.Add("bla");
    cats.Modified += eventListener.OnModified;
    cats.Add("bla"); // adding the same shouldn't fire
    Assert.Equals(0, eventListener.EventCount, 
       "Modified event was fired unnecessarily.");
 }
开发者ID:ManfredLange,项目名称:csUnit,代码行数:9,代码来源:CategoriesTests.cs

示例14: EmptyStringIsIgnoredAsCategory

 public void EmptyStringIsIgnoredAsCategory() {
    var cats = new Categories();
    cats.Add(string.Empty);
    Assert.Equals(0, cats.Count);
 }
开发者ID:ManfredLange,项目名称:csUnit,代码行数:5,代码来源:CategoriesTests.cs


注:本文中的Categories.Add方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。