public void TestAddItemCategory_正确添加()
        {
            string id = "c2ecf0ef-dc5b-4308-9f38-047453d53919";

            #region 验证前置条件

            MSSql2005Query query = new MSSql2005Query();
            string sqlQuery = query.GenerateSelectViewSql(typeof(ItemCategoryInfo));
            sqlQuery += string.Format("WHERE [Id] = N'{0}'", id);
            using (DbOperator dbOperator = new DbOperator(connString))
            {
                DataTable dt = dbOperator.GetTable(sqlQuery);

                Assert.AreEqual(0, dt.Rows.Count);
            }

            #endregion

            ItemCategoryFacade facade = new ItemCategoryFacade();
            string idNew = facade.AddItemCategory(id, "50011665", "0", "网游装备/游戏币/帐号/代练", false, "normal", 0);

            #region 验证后置条件

            Assert.AreEqual("c2ecf0ef-dc5b-4308-9f38-047453d53919", idNew, true);

            using (DbOperator dbOperator = new DbOperator(connString))
            {
                DataTable dt = dbOperator.GetTable(sqlQuery);

                Assert.AreEqual(1, dt.Rows.Count);
                Assert.AreEqual("c2ecf0ef-dc5b-4308-9f38-047453d53919", dt.Rows[0]["Id"].ToString(), true);
                Assert.AreEqual("50011665", dt.Rows[0]["CategoryId"].ToString(), true);
                Assert.AreEqual("0", dt.Rows[0]["ParentId"].ToString(), true);
                Assert.AreEqual("网游装备/游戏币/帐号/代练", dt.Rows[0]["Name"].ToString(), true);
                Assert.AreEqual("false", dt.Rows[0]["IsParent"].ToString(), true);
                Assert.AreEqual("normal", dt.Rows[0]["Status"].ToString(), true);
                Assert.AreEqual("0", dt.Rows[0]["SortOrder"].ToString(), true);
            }

            #endregion
        }
        public void TestAddArea_正确添加区域()
        {
            string id = "c2ecf0ef-dc5b-4308-9f38-037453d53919";

            #region 验证前置条件

            MSSql2005Query query = new MSSql2005Query();
            string sqlQuery = query.GenerateSelectViewSql(typeof(AreaInfo));
            sqlQuery += string.Format("WHERE [Id] = N'{0}'", id);
            using (DbOperator dbOperator = new DbOperator(connString))
            {
                DataTable dt = dbOperator.GetTable(sqlQuery);

                Assert.AreEqual(0, dt.Rows.Count);
            }

            #endregion

            AreaFacade facade = new AreaFacade();
            string idNew = facade.AddArea(id, "401331", AreaType.Province, "重庆市", "", "401331");

            #region 验证后置条件

            Assert.AreEqual("c2ecf0ef-dc5b-4308-9f38-037453d53919", idNew, true);

            using (DbOperator dbOperator = new DbOperator(connString))
            {
                DataTable dt = dbOperator.GetTable(sqlQuery);

                Assert.AreEqual(1, dt.Rows.Count);
                Assert.AreEqual("c2ecf0ef-dc5b-4308-9f38-037453d53919", dt.Rows[0]["Id"].ToString(), true);
                Assert.AreEqual("401331", dt.Rows[0]["AreaId"].ToString(), true);
                Assert.AreEqual("2", dt.Rows[0]["AreaType"].ToString(), true);
                Assert.AreEqual("重庆市", dt.Rows[0]["AreaName"].ToString(), true);
                Assert.AreEqual("", dt.Rows[0]["ParentId"].ToString(), true);
                Assert.AreEqual("401331", dt.Rows[0]["Zip"].ToString(), true);
            }

            #endregion
        }