Beispiel #1
0
        public void RevoqueDatabasePrivilege_DatabaseDoenstExist_NoticeInValidate()
        {
            IDatabaseContainer databaseContainer = ObjectConstructor.CreateDatabaseContainer();
            string             databaseName      = VariousFunctions.GenerateRandomString(8);

            while (databaseContainer.ExistDatabase(databaseName))
            {
                databaseName = VariousFunctions.GenerateRandomString(8);
            }
            RevokeDatabasePrivilege revoqueDatabasePrivilege = CreateRevoqueDatabasePrivilege(databaseContainer, SystemeConstants.SystemDatabaseName, SystemeConstants.PrivilegesOfProfilesOnDatabasesTableName);

            revoqueDatabasePrivilege.SetData(SystemeConstants.DefaultProfile, databaseName, SystemeConstants.CreatePrivilegeName);
            Assert.IsFalse(revoqueDatabasePrivilege.ValidateParameters());
        }
Beispiel #2
0
        public void RevoqueDatabasePrivilege_AllParamsExist_RowExist_DeleteRow()
        {
            IDatabaseContainer databaseContainer = ObjectConstructor.CreateDatabaseContainer();
            ITable             table             = databaseContainer.GetDatabase(SystemeConstants.SystemDatabaseName).GetTable(SystemeConstants.PrivilegesOfProfilesOnDatabasesTableName);
            Row row = table.CreateRowDefinition();

            row.GetCell(SystemeConstants.PrivilegesOfProfilesOnDatabasesProfileColumnName).data      = SystemeConstants.DefaultProfile;
            row.GetCell(SystemeConstants.PrivilegesOfProfilesOnDatabasesDatabaseNameColumnName).data = SystemeConstants.DefaultDatabaseName;
            row.GetCell(SystemeConstants.PrivilegesOfProfilesOnDatabasesPrivilegeColumnName).data    = SystemeConstants.CreatePrivilegeName;
            table.AddRow(row);
            int rowNumber = table.GetRowCount();
            RevokeDatabasePrivilege revoqueDatabasePrivilege = CreateRevoqueDatabasePrivilege(databaseContainer, SystemeConstants.SystemDatabaseName, SystemeConstants.PrivilegesOfProfilesOnDatabasesTableName);

            revoqueDatabasePrivilege.SetData(SystemeConstants.DefaultProfile, SystemeConstants.DefaultDatabaseName, SystemeConstants.CreatePrivilegeName);
            Assert.IsTrue(revoqueDatabasePrivilege.ValidateParameters());
            revoqueDatabasePrivilege.Execute();
            Assert.AreEqual(rowNumber - 1, table.GetRowCount());
        }