Ejemplo n.º 1
0
        public void GetAll()
        {
            try
            {
                _unitOfWork = new UnitOfWork();
                IUserRepository userRepository = new UserUnitOfWorkRepository(_unitOfWork);
                List <User>     list           = userRepository.GetAll().ToList();
                Assert.IsTrue(list != null && list.Count > 0);

                _unitOfWork.Commit();
            }
            catch (Exception ex)
            {
                Assert.IsTrue(false);
            }
        }
Ejemplo n.º 2
0
        public void Get()
        {
            try
            {
                _unitOfWork = new UnitOfWork();
                IUserRepository userRepository = new UserUnitOfWorkRepository(_unitOfWork);
                User            user           = userRepository.GetByKey(_id);

                Assert.AreEqual <System.Guid>(user.Id, _id);

                _unitOfWork.Commit();
            }
            catch (Exception ex)
            {
                Assert.IsTrue(false);
            }
        }
Ejemplo n.º 3
0
        public void Del()
        {
            try
            {
                _unitOfWork = new UnitOfWork();
                IUserRepository userRepository = new UserUnitOfWorkRepository(_unitOfWork);
                userRepository.Del(new User()
                {
                    Id = _id
                });

                _unitOfWork.Commit();
            }
            catch (Exception ex)
            {
                Assert.IsTrue(false);
            }
        }
Ejemplo n.º 4
0
        public void Save()
        {
            try
            {
                _unitOfWork = new UnitOfWork();
                IUserRepository userRepository = new UserUnitOfWorkRepository(_unitOfWork);

                User user = userRepository.GetByKey(_id);
                user.Name = "polan";
                userRepository.Save(user);

                _unitOfWork.Commit();
            }
            catch (Exception ex)
            {
                Assert.IsTrue(false);
            }
        }
Ejemplo n.º 5
0
        public void Add()
        {
            try
            {
                _unitOfWork = new UnitOfWork();
                IUserRepository userRepository = new UserUnitOfWorkRepository(_unitOfWork);
                if (userRepository.GetByKey(_id) == null)
                {
                    userRepository.Add(new User() { Id = _id, Duty = "管理员", Name = "hy", Email = "bbs", RoleId = "SuperManager",Password="******" });
                }

                _unitOfWork.Commit();
            }
            catch (Exception ex)
            {
                Assert.IsTrue(false);
            }
        }
Ejemplo n.º 6
0
        public void Add()
        {
            try
            {
                _unitOfWork = new UnitOfWork();
                IUserRepository userRepository = new UserUnitOfWorkRepository(_unitOfWork);
                if (userRepository.GetByKey(_id) == null)
                {
                    userRepository.Add(new User()
                    {
                        Id = _id, Duty = "管理员", Name = "hy", Email = "bbs", RoleId = "SuperManager", Password = "******"
                    });
                }

                _unitOfWork.Commit();
            }
            catch (Exception ex)
            {
                Assert.IsTrue(false);
            }
        }
Ejemplo n.º 7
0
        public void Get()
        {
            try
            {
                _unitOfWork = new UnitOfWork();
                IUserRepository userRepository = new UserUnitOfWorkRepository(_unitOfWork);
                User user = userRepository.GetByKey(_id);

                Assert.AreEqual<System.Guid>(user.Id, _id);

                _unitOfWork.Commit();
            }
            catch (Exception ex)
            {
                Assert.IsTrue(false);
            }
        }
Ejemplo n.º 8
0
        public void Del()
        {
            try
            {
                _unitOfWork = new UnitOfWork();
                IUserRepository userRepository = new UserUnitOfWorkRepository(_unitOfWork);
                userRepository.Del(new User() { Id = _id });

                _unitOfWork.Commit();
            }
            catch (Exception ex)
            {
                Assert.IsTrue(false);
            }
        }
Ejemplo n.º 9
0
        public void Save()
        {
            try
            {
                _unitOfWork = new UnitOfWork();
                IUserRepository userRepository = new UserUnitOfWorkRepository(_unitOfWork);

                User user = userRepository.GetByKey(_id);
                user.Name = "polan";
                userRepository.Save(user);

                _unitOfWork.Commit();
            }
            catch (Exception ex)
            {
                Assert.IsTrue(false);
            }
        }
Ejemplo n.º 10
0
        public void GetAll()
        {
            try
            {
                _unitOfWork = new UnitOfWork();
                IUserRepository userRepository = new UserUnitOfWorkRepository(_unitOfWork);
                List<User> list = userRepository.GetAll().ToList();
                Assert.IsTrue(list != null && list.Count > 0);

                _unitOfWork.Commit();
            }
            catch (Exception ex)
            {
                Assert.IsTrue(false);
            }
        }