Esempio n. 1
0
        public void GivenUserRoleUnknown_WhenGrantAccess_ThenThrowException()
        {
            ManageProviderPermission   target = new ManageProviderPermission(1);
            EducationSecurityPrincipal user   = CreateUserWithUnknownRole();

            target.ExpectException <EntityAccessUnauthorizedException>(() => target.GrantAccess(user));
        }
Esempio n. 2
0
        public void GivenUserIsProvider_AndUserAssignedDifferentProvidersThanSpecifiedToPermission_WhenGrantAccess_ThenThrowException()
        {
            ManageProviderPermission   target = new ManageProviderPermission(1);
            EducationSecurityPrincipal user   = CreateProviderUser(Data.Providers.Where(p => p.Id != 1).ToList());

            target.ExpectException <EntityAccessUnauthorizedException>(() => target.GrantAccess(user));
        }
Esempio n. 3
0
        public void GivenUserIsSiteCoordinator_WhenGrantAccess_ThenSucceed()
        {
            ManageProviderPermission   target = new ManageProviderPermission(1);
            EducationSecurityPrincipal user   = CreateSiteCoordinatorUser(new List <School>());

            target.GrantAccess(user);
        }
Esempio n. 4
0
        public void GivenUserIsProvider_AndUserAssignedNoProviders_WhenGrantAccess_ThenThrowException()
        {
            ManageProviderPermission   target = new ManageProviderPermission(1);
            EducationSecurityPrincipal user   = CreateProviderUser(new List <Provider>());

            target.ExpectException <EntityAccessUnauthorizedException>(() => target.GrantAccess(user));
        }
Esempio n. 5
0
        public void GivenUserIsProvider_AndUserAssignedAllProviders_WhenGrantAccess_ThenSucceed()
        {
            ManageProviderPermission   target = new ManageProviderPermission(1);
            EducationSecurityPrincipal user   = CreateProviderUser(Data.Providers);

            target.GrantAccess(user);
        }
        public void GivenUserRoleUnknown_WhenGrantAccess_ThenThrowException()
        {
            ManageProviderPermission target = new ManageProviderPermission(1);
            EducationSecurityPrincipal user = CreateUserWithUnknownRole();

            target.ExpectException<EntityAccessUnauthorizedException>(() => target.GrantAccess(user));
        }
Esempio n. 7
0
        public void GivenUserIsDataAdmin_WhenGrantAccess_ThenSucceed()
        {
            ManageProviderPermission   target = new ManageProviderPermission(1);
            EducationSecurityPrincipal user   = CreateDataAdminUser();

            target.GrantAccess(user);
        }
        public void GivenUserIsSiteCoordinator_WhenGrantAccess_ThenSucceed()
        {
            ManageProviderPermission target = new ManageProviderPermission(1);
            EducationSecurityPrincipal user = CreateSiteCoordinatorUser(new List<School>());

            target.GrantAccess(user);
        }
        public void GivenUserIsProvider_AndUserAssignedNoProviders_WhenGrantAccess_ThenThrowException()
        {
            ManageProviderPermission target = new ManageProviderPermission(1);
            EducationSecurityPrincipal user = CreateProviderUser(new List<Provider>());

            target.ExpectException<EntityAccessUnauthorizedException>(() => target.GrantAccess(user));
        }
        public void GivenUserIsProvider_AndUserAssignedDifferentProvidersThanSpecifiedToPermission_WhenGrantAccess_ThenThrowException()
        {
            ManageProviderPermission target = new ManageProviderPermission(1);
            EducationSecurityPrincipal user = CreateProviderUser(Data.Providers.Where(p => p.Id != 1).ToList());

            target.ExpectException<EntityAccessUnauthorizedException>(() => target.GrantAccess(user));
        }
        public void GivenUserIsProvider_AndUserAssignedAllProviders_WhenGrantAccess_ThenSucceed()
        {
            ManageProviderPermission target = new ManageProviderPermission(1);
            EducationSecurityPrincipal user = CreateProviderUser(Data.Providers);

            target.GrantAccess(user);
        }
        public void GivenUserIsDataAdmin_WhenGrantAccess_ThenSucceed()
        {
            ManageProviderPermission target = new ManageProviderPermission(1);
            EducationSecurityPrincipal user = CreateDataAdminUser();

            target.GrantAccess(user);
        }