Ejemplo n.º 1
0
        public void Add()
        {
            try
            {
                _unitOfWork = new UnitOfWork();
                IAuthorizeRepository authorizeRepository = new AuthorizeUnitOfWorkRepository(_unitOfWork);
                List <Authorize>     list = authorizeRepository.GetAll().ToList();
                if (list == null)
                {
                    list = new List <Authorize>();
                }
                if (list.Where(it => it.AuthorityName.Equals("Login")).FirstOrDefault() == null)
                {
                    authorizeRepository.Add(new Authorize()
                    {
                        AuthorityName = "Login", RoleName = "SuperManager,RegisterUser"
                    });
                }
                if (list.Where(it => it.AuthorityName.Equals("Register")).FirstOrDefault() == null)
                {
                    authorizeRepository.Add(new Authorize()
                    {
                        AuthorityName = "Register", RoleName = "SuperManager,RegisterUser"
                    });
                }


                _unitOfWork.Commit();
            }
            catch (Exception ex)
            {
                Assert.IsTrue(false);
            }
        }
Ejemplo n.º 2
0
        public void GetAll()
        {
            _unitOfWork = new UnitOfWork();
            IAuthorizeRepository authorizeRepository = new AuthorizeUnitOfWorkRepository(_unitOfWork);
            List <Authorize>     list = authorizeRepository.GetAll().ToList();

            Assert.IsTrue(list != null && list.Count > 0);

            _unitOfWork.Commit();
        }
Ejemplo n.º 3
0
        public void Add()
        {
            try
            {
                _unitOfWork = new UnitOfWork();
                IAuthorizeRepository authorizeRepository = new AuthorizeUnitOfWorkRepository(_unitOfWork);
                List<Authorize> list = authorizeRepository.GetAll().ToList();
                if (list == null) list = new List<Authorize>();
                if (list.Where(it => it.AuthorityName.Equals("Login")).FirstOrDefault() == null)
                {
                    authorizeRepository.Add(new Authorize() { AuthorityName = "Login", RoleName = "SuperManager,RegisterUser" });
                }
                if (list.Where(it => it.AuthorityName.Equals("Register")).FirstOrDefault() == null)
                {
                    authorizeRepository.Add(new Authorize() { AuthorityName = "Register", RoleName = "SuperManager,RegisterUser" });
                }

                _unitOfWork.Commit();
            }
            catch (Exception ex)
            {
                Assert.IsTrue(false);
            }
        }
Ejemplo n.º 4
0
        public void GetAll()
        {
            _unitOfWork = new UnitOfWork();
            IAuthorizeRepository authorizeRepository = new AuthorizeUnitOfWorkRepository(_unitOfWork);
            List<Authorize> list = authorizeRepository.GetAll().ToList();
            Assert.IsTrue(list != null && list.Count > 0);

            _unitOfWork.Commit();
        }