public void GivenUserIsSiteCoordinator_AndUserNotAssignedSchoolsForAllStudents_WhenGrantAccess_ThenThrowException()
        {
            ScheduleOfferingPermission target = new ScheduleOfferingPermission(Data.Students, Data.ServiceOfferings[0]);
            EducationSecurityPrincipal user   = CreateSiteCoordinatorUser(Data.Schools.Where(s => s != Data.Students.First().School).ToList());

            target.ExpectException <EntityAccessUnauthorizedException>(() => target.GrantAccess(user));
        }
        public void GivenUserIsProviderNotAssociatedToOffering_WhenGrantAccess_ThenSucceed()
        {
            ScheduleOfferingPermission target = new ScheduleOfferingPermission(Data.Students, Data.ServiceOfferings[0]);
            EducationSecurityPrincipal user   = CreateProviderUser(new List <Provider>());

            target.ExpectException <EntityAccessUnauthorizedException>(() => target.GrantAccess(user));
        }
        public void GivenUserIsSiteCoordinator_AndUserAssignedNoSchools_WhenGrantAccess_ThenThrowException()
        {
            ScheduleOfferingPermission target = new ScheduleOfferingPermission(Data.Students, Data.ServiceOfferings[0]);
            EducationSecurityPrincipal user   = CreateSiteCoordinatorUser(new List <School>());

            target.ExpectException <EntityAccessUnauthorizedException>(() => target.GrantAccess(user));
        }
        public void GivenUserIsProviderNotAssociatedToOffering_WhenGrantAccess_ThenSucceed()
        {
            ScheduleOfferingPermission target = new ScheduleOfferingPermission(Data.Students, Data.ServiceOfferings[0]);
            EducationSecurityPrincipal user = CreateProviderUser(new List<Provider>());

            target.ExpectException<EntityAccessUnauthorizedException>(() => target.GrantAccess(user));
        }
        public void GivenNullUser_WhenGrantAccess_ThenThrowException()
        {
            ScheduleOfferingPermission target = new ScheduleOfferingPermission(Data.Students, Data.ServiceOfferings[0]);

            target.ExpectException <ArgumentException>(() => target.GrantAccess(null));
        }
        public void GivenUserIsSiteCoordinator_AndUserNotAssignedSchoolsForAllStudents_WhenGrantAccess_ThenThrowException()
        {
            ScheduleOfferingPermission target = new ScheduleOfferingPermission(Data.Students, Data.ServiceOfferings[0]);
            EducationSecurityPrincipal user = CreateSiteCoordinatorUser(Data.Schools.Where(s => s != Data.Students.First().School).ToList());

            target.ExpectException<EntityAccessUnauthorizedException>(() => target.GrantAccess(user));
        }
        public void GivenUserIsSiteCoordinator_AndUserAssignedNoSchools_WhenGrantAccess_ThenThrowException()
        {
            ScheduleOfferingPermission target = new ScheduleOfferingPermission(Data.Students, Data.ServiceOfferings[0]);
            EducationSecurityPrincipal user = CreateSiteCoordinatorUser(new List<School>());

            target.ExpectException<EntityAccessUnauthorizedException>(() => target.GrantAccess(user));
        }
        public void GivenNullUser_WhenGrantAccess_ThenThrowException()
        {
            ScheduleOfferingPermission target = new ScheduleOfferingPermission(Data.Students, Data.ServiceOfferings[0]);

            target.ExpectException<ArgumentException>(() => target.GrantAccess(null));
        }