public void GivenUserIsProvider_AndUserAssignedDifferentProvidersThanAssignedServiceOffering_WhenGrantAccess_ThenThrowException() { ManageServiceAttendancePermission target = new ManageServiceAttendancePermission(Data.StudentAssignedOfferings.First()); EducationSecurityPrincipal user = CreateProviderUser(Data.Providers.Where(p => p != Data.StudentAssignedOfferings.First().ServiceOffering.Provider).ToList()); target.ExpectException<EntityAccessUnauthorizedException>(() => target.GrantAccess(user)); }
public void GivenUserIsProvider_AndUserAssignedNoProviders_WhenGrantAccess_ThenThrowException() { ManageServiceAttendancePermission target = new ManageServiceAttendancePermission(Data.StudentAssignedOfferings.First()); EducationSecurityPrincipal user = CreateProviderUser(new List<Provider>()); target.ExpectException<EntityAccessUnauthorizedException>(() => target.GrantAccess(user)); }
public void GivenUserRoleIsUnknown_WhenGrantAccess_ThenThrowException() { ManageServiceAttendancePermission target = new ManageServiceAttendancePermission(Data.StudentAssignedOfferings[0]); EducationSecurityPrincipal user = CreateUserWithUnknownRole(); target.ExpectException <EntityAccessUnauthorizedException>(() => target.GrantAccess(user)); }
public void GivenUserHasNoRole_WhenGrantAccess_ThenThrowException() { ManageServiceAttendancePermission target = new ManageServiceAttendancePermission(Data.StudentAssignedOfferings.First()); EducationSecurityPrincipal user = CreateUserWithNoRoles(); target.ExpectException<EntityAccessUnauthorizedException>(() => target.GrantAccess(user)); }
public void GivenUserIsProvider_AndUserAssignedDifferentProvidersThanAssignedServiceOffering_WhenGrantAccess_ThenThrowException() { ManageServiceAttendancePermission target = new ManageServiceAttendancePermission(Data.StudentAssignedOfferings.First()); EducationSecurityPrincipal user = CreateProviderUser(Data.Providers.Where(p => p != Data.StudentAssignedOfferings.First().ServiceOffering.Provider).ToList()); target.ExpectException <EntityAccessUnauthorizedException>(() => target.GrantAccess(user)); }
public void GivenUserIsProvider_AndUserAssignedNoProviders_WhenGrantAccess_ThenThrowException() { ManageServiceAttendancePermission target = new ManageServiceAttendancePermission(Data.StudentAssignedOfferings.First()); EducationSecurityPrincipal user = CreateProviderUser(new List <Provider>()); target.ExpectException <EntityAccessUnauthorizedException>(() => target.GrantAccess(user)); }
public void GivenUserIsSiteCoordinator_AndUserAssignedDifferentSchoolsThanAssignedOfferingStudent_WhenGrantAccess_ThenThrowException() { ManageServiceAttendancePermission target = new ManageServiceAttendancePermission(Data.StudentAssignedOfferings.First()); EducationSecurityPrincipal user = CreateSiteCoordinatorUser(Data.Schools.Where(s => s != Data.StudentAssignedOfferings.First().Student.School).ToList()); target.ExpectException <EntityAccessUnauthorizedException>(() => target.GrantAccess(user)); }
public void GivenUserIsSiteCoordinator_AndUserAssignedDifferentSchoolsThanAssignedOfferingStudent_WhenGrantAccess_ThenThrowException() { ManageServiceAttendancePermission target = new ManageServiceAttendancePermission(Data.StudentAssignedOfferings.First()); EducationSecurityPrincipal user = CreateSiteCoordinatorUser(Data.Schools.Where(s => s != Data.StudentAssignedOfferings.First().Student.School).ToList()); target.ExpectException<EntityAccessUnauthorizedException>(() => target.GrantAccess(user)); }
public void GivenNullUser_WhenGrantAccess_ThenThrowException() { ManageServiceAttendancePermission target = new ManageServiceAttendancePermission(new StudentAssignedOffering()); target.ExpectException<ArgumentNullException>(() => target.GrantAccess(null)); }
public void GivenNullUser_WhenGrantAccess_ThenThrowException() { ManageServiceAttendancePermission target = new ManageServiceAttendancePermission(new StudentAssignedOffering()); target.ExpectException <ArgumentNullException>(() => target.GrantAccess(null)); }