public void Delete_LoadData() { IAclManager manager = MockAclManager(); AclStorer storer = new AclStorer(manager, testFile); manager.StoreEntry("Res1", "Action1", "U.User", Value.Grant); manager.StoreEntry("Res2", "Action2", "G.Group", Value.Deny); manager.StoreEntry("Res3", "Action1", "U.User", Value.Grant); manager.StoreEntry("Res3", "Action2", "G.Group", Value.Deny); manager.DeleteEntriesForResource("Res3"); storer.Dispose(); storer = null; manager = MockAclManager(); storer = new AclStorer(manager, testFile); storer.LoadData(); Assert.AreEqual(2, manager.TotalEntries, "Wrong entry count"); AclEntry[] allEntries = manager.RetrieveAllEntries(); 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("Res2", "Action2", "G.Group", Value.Deny), allEntries[0]); AssertAclEntriesAreEqual(new AclEntry("Res1", "Action1", "U.User", Value.Grant), allEntries[1]); }
public void Overwrite_LoadData() { IAclManager manager = MockAclManager(); AclStorer storer = new AclStorer(manager, testFile); manager.StoreEntry("Res1", "Action1", "U.User", Value.Grant); manager.StoreEntry("Res2", "Action2", "G.Group", Value.Grant); manager.StoreEntry("Res2", "Action2", "G.Group", Value.Deny); // Overwrite storer.Dispose(); storer = null; manager = MockAclManager(); storer = new AclStorer(manager, testFile); storer.LoadData(); Assert.AreEqual(2, manager.TotalEntries, "Wrong entry count"); AclEntry[] allEntries = manager.RetrieveAllEntries(); 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("Res2", "Action2", "G.Group", Value.Deny), allEntries[0]); AssertAclEntriesAreEqual(new AclEntry("Res1", "Action1", "U.User", Value.Grant), allEntries[1]); }
public void Constructor() { IAclManager manager = MockAclManager(); AclStorer storer = new AclStorer(manager, testFile); Assert.AreSame(manager, storer.AclManager, "Wrong ACL Manager instance"); }
public void Constructor_InvalidFile_ShouldThrowArgumentException(string f) { Assert.Throws <ArgumentException>(() => { AclStorer storer = new AclStorer(MockAclManager(), f); }); }
public void Constructor_NullAclManager() { Assert.Throws <ArgumentNullException>(() => { AclStorer storer = new AclStorer(null, testFile); }); }
public void Constructor() { IAclManager manager = MockAclManager(); AclStorer storer = new AclStorer(manager, testFile); Assert.AreSame(manager, storer.AclManager, "Wrong ACL Manager instance"); }
public void Constructor_InvalidFile(string f) { AclStorer storer = new AclStorer(MockAclManager(), f); }
public void Constructor_NullAclManager() { AclStorer storer = new AclStorer(null, testFile); }
public void Constructor_NullAclManager() { AclStorer storer = new AclStorer(null, testFile); }
public void Constructor_InvalidFile(string f) { AclStorer storer = new AclStorer(MockAclManager(), f); }