Пример #1
0
        public void AddAndPurgeWorks()
        {
            TestSecurity security = new TestSecurity(false);

            NTAccount nta1 = new NTAccount(@"BUILTIN\Users");
            NTAccount nta2 = new NTAccount(@"BUILTIN\Administrators");

            security.AddAccessRuleTest(new TestAccessRule <TestRights> (nta1, TestRights.One,
                                                                        AccessControlType.Allow));
            security.AddAccessRuleTest(new TestAccessRule <TestRights> (nta2, TestRights.One,
                                                                        AccessControlType.Allow));

            AuthorizationRuleCollection rules1 = security.GetAccessRules(true, true, typeof(NTAccount));

            Assert.AreEqual(2, rules1.Count);

            security.PurgeAccessRules(nta1);
            AuthorizationRuleCollection rules2 = security.GetAccessRules(true, true, typeof(NTAccount));

            Assert.AreEqual(1, rules2.Count);
            Assert.IsInstanceOfType(typeof(TestAccessRule <TestRights>), rules2[0]);
            TestAccessRule <TestRights> rule = (TestAccessRule <TestRights>)rules2[0];

            Assert.AreEqual(nta2, rule.IdentityReference);
        }
Пример #2
0
		public void PurgeThrowsOnNull ()
		{
			TestSecurity security = new TestSecurity ();
			security.PurgeAccessRules (null);
		}
Пример #3
0
        public void PurgeThrowsOnNull()
        {
            TestSecurity security = new TestSecurity();

            security.PurgeAccessRules(null);
        }