Example #1
0
        public void None()
        {
            OleDbPermission perm = new OleDbPermission(PermissionState.None);

            Check("None-1", perm, false, false, 0);
            perm.AllowBlankPassword = true;
            Check("None-2", perm, true, false, 0);

            OleDbPermission copy = (OleDbPermission)perm.Copy();

            Check("Copy_None-1", copy, true, false, 0);
            copy.AllowBlankPassword = false;
            Check("Copy_None-2", copy, false, false, 0);
        }
Example #2
0
        public void Unrestricted()
        {
            OleDbPermission perm = new OleDbPermission(PermissionState.Unrestricted);

            Check("Unrestricted-1", perm, false, true, 0);
            perm.AllowBlankPassword = true;
            Check("Unrestricted-2", perm, true, true, 0);

            OleDbPermission copy = (OleDbPermission)perm.Copy();

            // note: Unrestricted is always created with default values (so AllowBlankPassword is false)
            Check("Copy_Unrestricted-1", copy, false, true, 0);
            copy.AllowBlankPassword = true;
            Check("Copy_Unrestricted-2", copy, true, true, 0);
        }
Example #3
0
        public void None_Childs()
        {
            OleDbPermission perm = new OleDbPermission(PermissionState.None);

            perm.Add("data source=localhost;", String.Empty, KeyRestrictionBehavior.AllowOnly);
            perm.Add("data source=127.0.0.1;", "password=;", KeyRestrictionBehavior.PreventUsage);

            Check("None-Childs-1", perm, false, false, 2);
            perm.AllowBlankPassword = true;
            Check("None-Childs-2", perm, true, false, 2);

            OleDbPermission copy = (OleDbPermission)perm.Copy();

            Check("Copy_None-Childs-1", copy, true, false, 2);
            copy.AllowBlankPassword = false;
            Check("Copy_None-Childs-2", copy, false, false, 2);
        }