Example #1
0
        protected override void EstablishContext()
        {
            windsorContainer = new WindsorContainer();
            authorizationInformationProvider = mocks.StrictMock<IAuthorizationInformationProvider>();
            sessionStateProvider = mocks.StrictMock<ISessionStateProvider>();
            currentUserClaimInterrogator = mocks.StrictMock<ICurrentUserClaimInterrogator>();
            currentUserAccessibleStudentsProvider = mocks.StrictMock<ICurrentUserAccessibleStudentsProvider>();
            RegisterServices(windsorContainer);
            var userAssociatedOrgs = UserInformation.Current.AssociatedSchools;
            foreach(var associatedOrg in userAssociatedOrgs)
            {
                foreach(var claimType in associatedOrg.ClaimTypes)
                {
                    Expect.Call(currentUserClaimInterrogator.HasClaimWithinEducationOrganizationHierarchy(claimType,associatedOrg.EducationOrganizationId
                                                                                                          )).Repeat.Any().Return(true);
                }
            }
            var userAssociatedLeaOrgs = UserInformation.Current.AssociatedLocalEducationAgencies;
            foreach (var associatedOrg in userAssociatedLeaOrgs)
            {
                foreach (var claimType in associatedOrg.ClaimTypes)
                {
                    Expect.Call(currentUserClaimInterrogator.HasClaimWithinEducationOrganizationHierarchy(claimType, associatedOrg.EducationOrganizationId
                                                                                                          )).Repeat.Any().Return(true);
                }
            }
            Expect.Call(currentUserClaimInterrogator.HasClaimForStateAgency(string.Empty)).Repeat.Any().Return(false).IgnoreArguments();
            
            CreateEdFiDashboardContext(LoginHelper.localEducationAgencyOneId);

            if (registerAccessibleStudentsInBase)
                Expect.Call(currentUserAccessibleStudentsProvider.GetAccessibleStudents(1, false)).IgnoreArguments().Repeat.
                    Any().Return(new AccessibleStudents { CanAccessAllStudents = false, StudentUSIs = GetAllStaffStudents() });

            //Expect.Call(authorizationInformationProvider.GetAllStaffStudentUSIs(providedStaffUSI)).Repeat.Any().Return(GetAllStaffStudents());

            //Expect.Call(authorizationInformationProvider.GetPrincipalStudentUSIs(providedStaffUSI)).Repeat.Any().Return(GetPrincipalStudents());
            //Expect.Call(authorizationInformationProvider.GetStaffCohortStudentUSIs(providedStaffUSI)).Repeat.Any().Return(GetCohortStudents());
            //Expect.Call(authorizationInformationProvider.GetTeacherStudentUSIs(providedStaffUSI)).Repeat.Any().Return(GetTeacherStudents());

            base.EstablishContext();
        }
Example #2
0
 public StudentInterceptor(ICurrentUserAccessibleStudentsProvider currentUserAccessibleStudentsProvider)
 {
     this.currentUserAccessibleStudentsProvider = currentUserAccessibleStudentsProvider;
 }