public void RenameResource() { _renameResource.Stub(x => x("res", "newName")).Return(true); _mocks.ReplayAll(); SqlAclManager manager = new SqlAclManager(_storeEntry, _deleteEntries, _renameResource, _retrieveAllEntries, _retrieveEntriesForResource, _retrieveEntriesForSubject); Assert.IsTrue(manager.RenameResource("res", "newName"), "RenameResource should return true"); _mocks.VerifyAll(); }
public void DeleteEntry() { _deleteEntries.Stub(x => x(new[] { new AclEntry("res", "action", "subject", Value.Deny) })).Return(true); _mocks.ReplayAll(); SqlAclManager manager = new SqlAclManager(_storeEntry, _deleteEntries, _renameResource, _retrieveAllEntries, _retrieveEntriesForResource, _retrieveEntriesForSubject); Assert.IsTrue(manager.DeleteEntry("res", "action", "subject"), "DeleteEntry should return true"); _mocks.VerifyAll(); }
public void DeleteEntry() { _deleteEntries.Stub(x => x(new[] { new AclEntry("res", "action", "subject", Value.Deny) })).Return(true); _mocks.ReplayAll(); SqlAclManager manager = new SqlAclManager(_storeEntry, _deleteEntries, _renameResource, _retrieveAllEntries, _retrieveEntriesForResource, _retrieveEntriesForSubject); Assert.IsTrue(manager.DeleteEntry("res", "action", "subject"), "DeleteEntry should return true"); _mocks.VerifyAll(); }
public void TotalEntries() { AclEntry[] entries = new[] { new AclEntry("res1", "action1", "subject", Value.Grant), new AclEntry("res1", "action1", "subject", Value.Deny), new AclEntry("res2", "action2", "subject", Value.Grant) }; _retrieveAllEntries.Stub(x => x()).Return(entries); _mocks.ReplayAll(); SqlAclManager manager = new SqlAclManager(_storeEntry, _deleteEntries, _renameResource, _retrieveAllEntries, _retrieveEntriesForResource, _retrieveEntriesForSubject); Assert.AreEqual(entries.Length, manager.TotalEntries, "Wrong entry count"); _mocks.VerifyAll(); }
public void DeleteEntriesForSubject() { AclEntry[] entries = new[] { new AclEntry("res1", "action1", "subject", Value.Grant), new AclEntry("res1", "action1", "subject", Value.Deny), new AclEntry("res2", "action2", "subject", Value.Grant) }; _retrieveEntriesForSubject.Stub(x => x("subject")).Return(entries); _deleteEntries.Stub(x => x(entries)).Return(true); _mocks.ReplayAll(); SqlAclManager manager = new SqlAclManager(_storeEntry, _deleteEntries, _renameResource, _retrieveAllEntries, _retrieveEntriesForResource, _retrieveEntriesForSubject); Assert.IsTrue(manager.DeleteEntriesForSubject("subject"), "DeleteEntriesForSubject should return true"); _mocks.VerifyAll(); }
public void RetrieveEntriesForSubject() { AclEntry[] entries = new[] { new AclEntry("res1", "action1", "subject", Value.Grant), new AclEntry("res1", "action1", "subject", Value.Deny), new AclEntry("res2", "action2", "subject", Value.Grant) }; _retrieveEntriesForSubject.Stub(x => x("subject")).Return(entries); _mocks.ReplayAll(); SqlAclManager manager = new SqlAclManager(_storeEntry, _deleteEntries, _renameResource, _retrieveAllEntries, _retrieveEntriesForResource, _retrieveEntriesForSubject); // Returned array reference-equals entries Assert.AreEqual(entries, manager.RetrieveEntriesForSubject("subject"), "Wrong array returned"); _mocks.VerifyAll(); }
public void DeleteEntriesForSubject() { AclEntry[] entries = new[] { new AclEntry("res1", "action1", "subject", Value.Grant), new AclEntry("res1", "action1", "subject", Value.Deny), new AclEntry("res2", "action2", "subject", Value.Grant) }; _retrieveEntriesForSubject.Stub(x => x("subject")).Return(entries); _deleteEntries.Stub(x => x(entries)).Return(true); _mocks.ReplayAll(); SqlAclManager manager = new SqlAclManager(_storeEntry, _deleteEntries, _renameResource, _retrieveAllEntries, _retrieveEntriesForResource, _retrieveEntriesForSubject); Assert.IsTrue(manager.DeleteEntriesForSubject("subject"), "DeleteEntriesForSubject should return true"); _mocks.VerifyAll(); }
public void RenameResource() { _renameResource.Stub(x => x("res", "newName")).Return(true); _mocks.ReplayAll(); SqlAclManager manager = new SqlAclManager(_storeEntry, _deleteEntries, _renameResource, _retrieveAllEntries, _retrieveEntriesForResource, _retrieveEntriesForSubject); Assert.IsTrue(manager.RenameResource("res", "newName"), "RenameResource should return true"); _mocks.VerifyAll(); }
public void TotalEntries() { AclEntry[] entries = new[] { new AclEntry("res1", "action1", "subject", Value.Grant), new AclEntry("res1", "action1", "subject", Value.Deny), new AclEntry("res2", "action2", "subject", Value.Grant) }; _retrieveAllEntries.Stub(x => x()).Return(entries); _mocks.ReplayAll(); SqlAclManager manager = new SqlAclManager(_storeEntry, _deleteEntries, _renameResource, _retrieveAllEntries, _retrieveEntriesForResource, _retrieveEntriesForSubject); Assert.AreEqual(entries.Length, manager.TotalEntries, "Wrong entry count"); _mocks.VerifyAll(); }
public void RetrieveEntriesForSubject() { AclEntry[] entries = new[] { new AclEntry("res1", "action1", "subject", Value.Grant), new AclEntry("res1", "action1", "subject", Value.Deny), new AclEntry("res2", "action2", "subject", Value.Grant) }; _retrieveEntriesForSubject.Stub(x => x("subject")).Return(entries); _mocks.ReplayAll(); SqlAclManager manager = new SqlAclManager(_storeEntry, _deleteEntries, _renameResource, _retrieveAllEntries, _retrieveEntriesForResource, _retrieveEntriesForSubject); // Returned array reference-equals entries Assert.AreEqual(entries, manager.RetrieveEntriesForSubject("subject"), "Wrong array returned"); _mocks.VerifyAll(); }