Exemplo n.º 1
0
        public void AddEntityTest()
        {
            UserRole role = new UserRole()
            {
                CNName = "Admin",
                ENName = "普通管理员"
            };
            UserInfo user = new UserInfo()
            {
                UserName = "******",
                Password = "******",
                Roles    = new List <UserRole>()
                {
                    role
                }
            };

            userDal.AddEntity(user);
            var result = session.SaveChanges();


            Assert.IsTrue(user.ID > 0);
            Assert.IsTrue(result > 0);
        }
Exemplo n.º 2
0
        public void AddEntityTest()
        {
            //var data= viewDal.LoadEntity(p=>true).ToList();
            //int count = data.Count();

            UserInfo user = new UserInfo()
            {
                UserName   = "******",
                Password   = "******",
                CreateTime = DateTime.Now,
                Email      = "*****@*****.**"
            };

            dal.AddEntity(user);
            Assert.IsTrue(dbsession.SaveChanges() > 0);
        }