public void RetrieveEntriesForResource_Resource_Empty() { AclManagerBase manager = MockAclManager(); var ex = Assert.Throws <ArgumentException>(() => manager.RetrieveEntriesForResource("")); Assert.Equal("Resource cannot be empty.\r\nParameter name: resource", ex.Message); }
public void RetrieveEntriesForResource_Resource_Null() { AclManagerBase manager = MockAclManager(); var ex = Assert.Throws <ArgumentNullException>(() => manager.RetrieveEntriesForResource(null)); Assert.Equal("Value cannot be null.\r\nParameter name: resource", ex.Message); }
public void RetrieveEntriesForResource_InvalidResource_ShouldThrowArgumentException(string r) { Assert.Throws <ArgumentException>(() => { AclManagerBase manager = MockAclManager(); manager.RetrieveEntriesForResource(r); }); }
public void RetrieveEntriesForResource() { 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.RetrieveEntriesForResource("Inexistent").Length, "Wrong result count"); AclEntry[] allEntries = manager.RetrieveEntriesForResource("Res"); Assert.AreEqual(2, allEntries.Length, "Wrong entry count"); Array.Sort(allEntries, delegate(AclEntry x, AclEntry y) { return(x.Subject.CompareTo(y.Subject)); }); AssertAclEntriesAreEqual(new AclEntry("Res", "Action", "G.Group", Value.Deny), allEntries[0]); AssertAclEntriesAreEqual(new AclEntry("Res", "Action", "U.User", Value.Grant), allEntries[1]); }
public void RetrieveEntriesForResource_InvalidResource(string r) { AclManagerBase manager = MockAclManager( ); manager.RetrieveEntriesForResource(r); }