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 GivenUserIsSiteCoordinator_AndUserAssignedAllSchools_WhenGrantAccess_ThenSucceed() { ScheduleOfferingPermission target = new ScheduleOfferingPermission(Data.Students, Data.ServiceOfferings[0]); EducationSecurityPrincipal user = CreateSiteCoordinatorUser(Data.Schools); target.GrantAccess(user); }
public void GivenUserIsDataAdmin_WhenGrantAccess_ThenSucceed() { ScheduleOfferingPermission target = new ScheduleOfferingPermission(Data.Students, Data.ServiceOfferings[0]); EducationSecurityPrincipal user = CreateDataAdminUser(); 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 GivenUserIsProvider_AndOfferingNotPassedIn_WhenGrantAccess_ThenSucceed() { ScheduleOfferingPermission target = new ScheduleOfferingPermission(Data.Students); EducationSecurityPrincipal user = CreateProviderUser(new List <Provider>()); target.GrantAccess(user); }
public void GivenUserIsProvider_AndOfferingNotPassedIn_WhenGrantAccess_ThenSucceed() { ScheduleOfferingPermission target = new ScheduleOfferingPermission(Data.Students); EducationSecurityPrincipal user = CreateProviderUser(new List<Provider>()); 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 GivenUserIsProviderAssociatedToOffering_WhenGrantAccess_ThenSucceed() { ScheduleOfferingPermission target = new ScheduleOfferingPermission(Data.Students, Data.ServiceOfferings[0]); EducationSecurityPrincipal user = CreateProviderUser(new List<Provider> { Data.ServiceOfferings[0].Provider }); target.GrantAccess(user); }
public void GivenUserIsProviderAssociatedToOffering_WhenGrantAccess_ThenSucceed() { ScheduleOfferingPermission target = new ScheduleOfferingPermission(Data.Students, Data.ServiceOfferings[0]); EducationSecurityPrincipal user = CreateProviderUser(new List <Provider> { Data.ServiceOfferings[0].Provider }); 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)); }