Beispiel #1
0
        public static void AdditionalTestCases()
        {
            bool isContainer = false;
            bool isDS        = false;

            RawAcl    rawAcl    = null;
            SystemAcl systemAcl = null;

            byte revision = 0;
            int  capacity = 0;

            //case 1, null Sid


            Assert.Throws <ArgumentNullException>(() =>
            {
                revision    = 127;
                capacity    = 1;
                rawAcl      = new RawAcl(revision, capacity);
                isContainer = true;
                isDS        = false;
                systemAcl   = new SystemAcl(isContainer, isDS, rawAcl);
                systemAcl.Purge(null);
            });
        }
Beispiel #2
0
        private static bool TestPurge(SystemAcl systemAcl, SecurityIdentifier sid, int aceCount)
        {
            KnownAce ace = null;

            systemAcl.Purge(sid);
            if (aceCount != systemAcl.Count)
            {
                return(false);
            }
            for (int i = 0; i < systemAcl.Count; i++)
            {
                ace = systemAcl[i] as KnownAce;
                if (ace != null && ((ace.AceFlags & AceFlags.Inherited) == 0))
                {
                    if (ace.SecurityIdentifier == sid)
                    {
                        return(false);
                    }
                }
            }
            return(true);
        }
Beispiel #3
0
 private static bool TestPurge(SystemAcl systemAcl, SecurityIdentifier sid, int aceCount)
 {
     KnownAce ace = null;
     systemAcl.Purge(sid);
     if (aceCount != systemAcl.Count)
         return false;
     for (int i = 0; i < systemAcl.Count; i++)
     {
         ace = systemAcl[i] as KnownAce;
         if (ace != null && ((ace.AceFlags & AceFlags.Inherited) == 0))
         {
             if (ace.SecurityIdentifier == sid)
                 return false;
         }
     }
     return true;
 }
Beispiel #4
0
        public static void AdditionalTestCases()
        {
            bool isContainer = false;
            bool isDS = false;

            RawAcl rawAcl = null;
            SystemAcl systemAcl = null;

            byte revision = 0;
            int capacity = 0;
            //case 1, null Sid


            Assert.Throws<ArgumentNullException>(() =>
            {
                revision = 127;
                capacity = 1;
                rawAcl = new RawAcl(revision, capacity);
                isContainer = true;
                isDS = false;
                systemAcl = new SystemAcl(isContainer, isDS, rawAcl);
                systemAcl.Purge(null);
            });
        }