Ejemplo n.º 1
0
        public void GetAgenciesForAdmin()
        {
            IRepository <Agency> ag1 = GetAgenciesByRole(FixedRoles.GlobalOfficer);

            IQueryable <Agency> ag2 = new ccEntities().Agencies;

            Assert.IsTrue(ag1.Select.Count() == ag2.Count(), "Admin can see all agencies");
        }
Ejemplo n.º 2
0
        public void GetAgenciesForUserAgency_SameRegion()
        {
            //regional officer can only see agencies for this region
            ccEntities entities = new ccEntities();
            User       user     = Helper.GetUser(FixedRoles.AgencyUser, "Agency1_FirstTest");
            //get region from agency
            int agId = (int)user.AgencyId;
            //    int regId = (int)user.Agency.RegionId;

            IRepository <Agency> ag1 = GetAgenciesByRole(FixedRoles.AgencyUser, "Agency1_FirstTest");

            //agencies from same region
            IQueryable <Agency> ag2 = new ccEntities().Agencies.Where(a => a.Id == agId);

            Assert.IsTrue(ag1.Select.Count() == ag2.Count(), "Agency officer get all agencies from his agency");
        }