public void Defaults ()
		{
			TestSecurity security = new TestSecurity ();
			Assert.IsTrue (security.AreAccessRulesCanonical);
			Assert.IsTrue (security.AreAuditRulesCanonical);
			Assert.IsFalse (security.AreAccessRulesProtected);
			Assert.IsFalse (security.AreAuditRulesProtected);
			Assert.IsNull (security.GetGroup (typeof (SecurityIdentifier)));
			Assert.IsNull (security.GetOwner (typeof (SecurityIdentifier)));
		}
Example #2
0
        public void Defaults()
        {
            TestSecurity security = new TestSecurity();

            Assert.IsTrue(security.AreAccessRulesCanonical);
            Assert.IsTrue(security.AreAuditRulesCanonical);
            Assert.IsFalse(security.AreAccessRulesProtected);
            Assert.IsFalse(security.AreAuditRulesProtected);
            Assert.IsNull(security.GetGroup(typeof(SecurityIdentifier)));
            Assert.IsNull(security.GetOwner(typeof(SecurityIdentifier)));
        }
Example #3
0
        public void AllTypesAcceptedOnGetGroupOwnerUntilTheyAreSet()
        {
            TestSecurity security = new TestSecurity();

            Assert.IsNull(security.GetGroup(typeof(void)));
            Assert.IsNull(security.GetOwner(typeof(int)));

            SecurityIdentifier everyoneSid = new SecurityIdentifier("WD");

            security.SetOwner(everyoneSid);

            bool throwsOnInt = false;

            try { security.GetOwner(typeof(int)); } catch (ArgumentException) { throwsOnInt = true; }
            Assert.IsTrue(throwsOnInt);

            bool throwsOnSuperclass = false;

            try { security.GetOwner(typeof(IdentityReference)); } catch (ArgumentException) { throwsOnSuperclass = true; }
            Assert.IsTrue(throwsOnSuperclass);

            Assert.IsNull(security.GetGroup(typeof(void)));
            Assert.IsInstanceOfType(typeof(SecurityIdentifier), security.GetOwner(typeof(SecurityIdentifier)));
        }
		public void AllTypesAcceptedOnGetGroupOwnerUntilTheyAreSet ()
		{
			TestSecurity security = new TestSecurity ();
			Assert.IsNull (security.GetGroup (typeof (void)));
			Assert.IsNull (security.GetOwner (typeof (int)));

			SecurityIdentifier everyoneSid = new SecurityIdentifier ("WD");
			security.SetOwner (everyoneSid);

			bool throwsOnInt = false;
			try { security.GetOwner (typeof (int)); } catch (ArgumentException) { throwsOnInt = true; }
			Assert.IsTrue (throwsOnInt);

			bool throwsOnSuperclass = false;
			try { security.GetOwner (typeof (IdentityReference)); } catch (ArgumentException) { throwsOnSuperclass = true; }
			Assert.IsTrue (throwsOnSuperclass);

			Assert.IsNull (security.GetGroup (typeof (void)));
			Assert.IsInstanceOfType (typeof (SecurityIdentifier), security.GetOwner (typeof (SecurityIdentifier)));
		}