コード例 #1
0
        public void RetrieveEntriesForSubject_Subject_Empty()
        {
            AclManagerBase manager = MockAclManager();
            var            ex      = Assert.Throws <ArgumentException>(() => manager.RetrieveEntriesForSubject(""));

            Assert.Equal("Subject cannot be empty.\r\nParameter name: subject", ex.Message);
        }
コード例 #2
0
        public void RetrieveEntriesForSubject_Subject_Null()
        {
            AclManagerBase manager = MockAclManager();
            var            ex      = Assert.Throws <ArgumentNullException>(() => manager.RetrieveEntriesForSubject(null));

            Assert.Equal("Value cannot be null.\r\nParameter name: subject", ex.Message);
        }
コード例 #3
0
 public void RetrieveEntriesForSubject_InvalidSubject_ShouldThrowArgumentException(string s)
 {
     Assert.Throws <ArgumentException>(() =>
     {
         AclManagerBase manager = MockAclManager();
         manager.RetrieveEntriesForSubject(s);
     });
 }
コード例 #4
0
        public void RetrieveEntriesForSubject()
        {
            AclManagerBase manager = MockAclManager();

            Assert.IsTrue(manager.StoreEntry("Res", "Action", "U.User", Value.Grant), "StoreEntry should return true");
            Assert.IsTrue(manager.StoreEntry("Res", "Action", "G.Group", Value.Deny), "StoreEntry should return true");
            Assert.IsTrue(manager.StoreEntry("Res2", "Action2", "G.Group2", Value.Grant), "StoreEntry should return true");
            Assert.IsTrue(manager.StoreEntry("Res2", "Action3", "G.Group2", Value.Deny), "StoreEntry should return true");

            Assert.AreEqual(0, manager.RetrieveEntriesForSubject("I.Inexistent").Length, "Wrong result count");

            AclEntry[] allEntries = manager.RetrieveEntriesForSubject("G.Group2");
            Assert.AreEqual(2, allEntries.Length, "Wrong entry count");

            Array.Sort(allEntries, delegate(AclEntry x, AclEntry y) { return(x.Action.CompareTo(y.Action)); });

            AssertAclEntriesAreEqual(new AclEntry("Res2", "Action2", "G.Group2", Value.Grant), allEntries[0]);
            AssertAclEntriesAreEqual(new AclEntry("Res2", "Action3", "G.Group2", Value.Deny), allEntries[1]);
        }
コード例 #5
0
        public void RetrieveEntriesForSubject_InvalidSubject(string s)
        {
            AclManagerBase manager = MockAclManager( );

            manager.RetrieveEntriesForSubject(s);
        }