public void TestIsItemCategoryExist_不存在的情况() { ItemCategoryFacade facade = new ItemCategoryFacade(); bool isExist = facade.IsItemCategoryExist("50011665"); Assert.AreEqual(false, isExist); }
public void TestIsItemCategoryExist_已经存在的情况() { #region 验证前置条件 ItemCategory category = new ItemCategory(); category.Id = "c2ecf0ef-dc5b-4308-9f38-047453d53919"; category.CategoryId = "50011665"; ItemCategoryManager manager = new ItemCategoryManager(); string sqlCreate = manager.GetCreateSql(category); using (DbOperator dbOperator = new DbOperator(connString)) { dbOperator.ExecSql(sqlCreate); } #endregion ItemCategoryFacade facade = new ItemCategoryFacade(); bool isExist = facade.IsItemCategoryExist("50011665"); Assert.AreEqual(true, isExist); }
private int UpdateSubItemCategories(string parentId) { ItemCategoryFacade localFacade = new ItemCategoryFacade(); localFacade.DeleteItemCategoryByParentId(parentId); CategoryFacade topFacade = new CategoryFacade(varHelper.TOP_AppKey, varHelper.TOP_AppSecret); TOPDataList<ItemCategory> list = topFacade.GetItemCategories(parentId, string.Empty); foreach (ItemCategory category in list) { if (!localFacade.IsItemCategoryExist(category.Id)) { localFacade.AddItemCategory(string.Empty, category.Id, category.ParentId, category.Name, category.IsParent, category.Status, category.SortOrder); } } return list.Count; }