Пример #1
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);
            }
        }
Пример #2
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);
            }
        }
Пример #3
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);
            }
        }
Пример #4
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);
            }
        }
Пример #5
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);
            }
        }
Пример #6
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);
            }
        }