public void GivenUserIsSiteCoordinator_AndCustomFieldIsPrivateFieldWithNoProvider_WhenGrantAccess_ThenThrowException()
        {
            CustomFieldDataPermission target = new CustomFieldDataPermission(new PrivateHealthField());
            EducationSecurityPrincipal user = CreateSiteCoordinatorUser(Data.Schools);

            target.ExpectException<EntityAccessUnauthorizedException>(() => target.GrantAccess(user));
        }
        public void GivenUserIsProvider_AndCustomFieldIsProviderFieldNotWithAssociatedProvider_WhenGrantAccess_ThenSucceed()
        {
            CustomFieldDataPermission target = new CustomFieldDataPermission(new PrivateHealthField());
            EducationSecurityPrincipal user = CreateProviderUser(Data.Providers);

            target.ExpectException<EntityAccessUnauthorizedException>(() => target.GrantAccess(user));
        }
        public void GivenUserIsProvider_AndCustomFieldIsProviderFieldWithAssociatedProvider_WhenGrantAccess_ThenSucceed()
        {
            CustomFieldDataPermission target = new CustomFieldDataPermission(new PrivateHealthField { Provider = Data.Providers[0], ProviderId = Data.Providers[0].Id });
            EducationSecurityPrincipal user = CreateProviderUser(Data.Providers);

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

            target.GrantAccess(user);
        }
        public void GivenUserIsNotDataAdmin_AndCustomFieldIsPublicField_WhenGrantAccess_ThenSucceed()
        {
            CustomFieldDataPermission target = new CustomFieldDataPermission(new PublicField());
            EducationSecurityPrincipal user = CreateSiteCoordinatorUser(Data.Schools);

            target.GrantAccess(user);
        }
Пример #6
0
        public void GivenUserIsSiteCoordinator_AndCustomFieldIsPrivateFieldWithNoProvider_WhenGrantAccess_ThenThrowException()
        {
            CustomFieldDataPermission  target = new CustomFieldDataPermission(new PrivateHealthField());
            EducationSecurityPrincipal user   = CreateSiteCoordinatorUser(Data.Schools);

            target.ExpectException <EntityAccessUnauthorizedException>(() => target.GrantAccess(user));
        }
        public void GivenUserHasNoRoles_WhenGrantAccess_ThenThrowException()
        {
            CustomFieldDataPermission target = new CustomFieldDataPermission(new PrivateHealthField());
            EducationSecurityPrincipal user = CreateUserWithNoRoles();

            target.ExpectException<EntityAccessUnauthorizedException>(() => target.GrantAccess(user));
        }
Пример #8
0
        public void GivenUserIsProvider_AndCustomFieldIsProviderFieldNotWithAssociatedProvider_WhenGrantAccess_ThenSucceed()
        {
            CustomFieldDataPermission  target = new CustomFieldDataPermission(new PrivateHealthField());
            EducationSecurityPrincipal user   = CreateProviderUser(Data.Providers);

            target.ExpectException <EntityAccessUnauthorizedException>(() => target.GrantAccess(user));
        }
Пример #9
0
        public void GivenUserIsNotDataAdmin_AndCustomFieldIsPublicField_WhenGrantAccess_ThenSucceed()
        {
            CustomFieldDataPermission  target = new CustomFieldDataPermission(new PublicField());
            EducationSecurityPrincipal user   = CreateSiteCoordinatorUser(Data.Schools);

            target.GrantAccess(user);
        }
Пример #10
0
        public void GivenUserIsDataAdmin_WhenGrantAccess_ThenSucceed()
        {
            CustomFieldDataPermission  target = new CustomFieldDataPermission(new PrivateHealthField());
            EducationSecurityPrincipal user   = CreateDataAdminUser();

            target.GrantAccess(user);
        }
Пример #11
0
        public void GivenUserHasNoRoles_WhenGrantAccess_ThenThrowException()
        {
            CustomFieldDataPermission  target = new CustomFieldDataPermission(new PrivateHealthField());
            EducationSecurityPrincipal user   = CreateUserWithNoRoles();

            target.ExpectException <EntityAccessUnauthorizedException>(() => target.GrantAccess(user));
        }
Пример #12
0
        public void GivenUserIsProvider_AndCustomFieldIsProviderFieldWithAssociatedProvider_WhenGrantAccess_ThenSucceed()
        {
            CustomFieldDataPermission target = new CustomFieldDataPermission(new PrivateHealthField {
                Provider = Data.Providers[0], ProviderId = Data.Providers[0].Id
            });
            EducationSecurityPrincipal user = CreateProviderUser(Data.Providers);

            target.GrantAccess(user);
        }
        public void GivenNullUser_WhenGrantAccess_ThenThrowException()
        {
            CustomFieldDataPermission target = new CustomFieldDataPermission(new PrivateHealthField());

            target.ExpectException<ArgumentNullException>(() => target.GrantAccess(null));
        }
Пример #14
0
        public void GivenNullUser_WhenGrantAccess_ThenThrowException()
        {
            CustomFieldDataPermission target = new CustomFieldDataPermission(new PrivateHealthField());

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