public void RevokePrivilege_AllOK_RevokePrivilege()
        {
            //Prefase
            IDatabaseContainer databaseContainer = ObjectConstructor.CreateDatabaseContainer();
            IDatabase          database          = databaseContainer.GetDatabase(SystemeConstants.DefaultDatabaseName);
            Table table = new Table("table");

            database.AddTable(table);
            string         profileName    = SystemeConstants.DefaultProfile;
            string         privilegeName  = SystemeConstants.InsertPrivilegeName;
            GrantPrivilege grantPrivilege = TestGrantPrivilege.CreateGrantPrivilege(databaseContainer, SystemeConstants.SystemDatabaseName, SystemeConstants.PrivilegesOfProfilesOnTablesTableName);

            grantPrivilege.SetData(privilegeName, profileName, database.databaseName, table.tableName);
            grantPrivilege.ValidateParameters();
            grantPrivilege.Execute();
            ITable profilesPrivilegesTable = databaseContainer.GetDatabase(SystemeConstants.SystemDatabaseName).GetTable(SystemeConstants.PrivilegesOfProfilesOnTablesTableName);
            int    rowCounts = profilesPrivilegesTable.GetRowCount();
            //Test
            RevoquePrivilege revoquePrivilege = CreateRevokePrivilege(databaseContainer, SystemeConstants.SystemDatabaseName, SystemeConstants.PrivilegesOfProfilesOnTablesTableName);

            revoquePrivilege.SetData(profileName, database.databaseName, table.tableName, privilegeName);
            Assert.IsTrue(revoquePrivilege.ValidateParameters());
            revoquePrivilege.Execute();
            Assert.AreEqual(rowCounts - 1, profilesPrivilegesTable.GetRowCount());
        }
        public void GrantPrivilege_AllParametersAreOK_GrantThePrivilege()
        {
            IDatabaseContainer databaseContainer = ObjectConstructor.CreateDatabaseContainer();
            IDatabase          database          = databaseContainer.GetDatabase(SystemeConstants.DefaultDatabaseName);
            Table table = new Table("table");

            database.AddTable(table);
            GrantPrivilege grantPrivilege = CreateGrantPrivilege(databaseContainer, SystemeConstants.SystemDatabaseName, SystemeConstants.PrivilegesOfProfilesOnTablesTableName);

            grantPrivilege.SetData(SystemeConstants.InsertPrivilegeName, SystemeConstants.DefaultProfile, database.databaseName, table.tableName);
            Assert.IsTrue(grantPrivilege.ValidateParameters());
        }
        public void GrantPrivilege_DatabaseDoenstExist_NoticeInValidate()
        {
            IDatabaseContainer databaseContainer  = ObjectConstructor.CreateDatabaseContainer();
            string             randomDatabaseName = VariousFunctions.GenerateRandomString(8);

            while (databaseContainer.ExistDatabase(randomDatabaseName))
            {
                randomDatabaseName = VariousFunctions.GenerateRandomString(8);
            }
            GrantPrivilege grantPrivilege = CreateGrantPrivilege(databaseContainer, SystemeConstants.SystemDatabaseName, SystemeConstants.PrivilegesOfProfilesOnTablesTableName);

            grantPrivilege.SetData(SystemeConstants.InsertPrivilegeName, SystemeConstants.DefaultProfile, randomDatabaseName, "aaa");
            Assert.IsFalse(grantPrivilege.ValidateParameters());
        }
        public void GrantPrivilege_ProfileDoenstExist_NoticeInValidate()
        {
            IDatabaseContainer databaseContainer = ObjectConstructor.CreateDatabaseContainer();
            IDatabase          targetDatabase    = databaseContainer.GetDatabase(SystemeConstants.SystemDatabaseName);
            Column             column            = targetDatabase.GetTable(SystemeConstants.ProfilesTableName).GetColumn(SystemeConstants.ProfileNameColumn);
            string             profileName       = VariousFunctions.GenerateRandomString(8);

            while (column.ExistCells(profileName))
            {
                profileName = VariousFunctions.GenerateRandomString(8);
            }
            GrantPrivilege grantPrivilege = CreateGrantPrivilege(databaseContainer, targetDatabase.databaseName, SystemeConstants.PrivilegesOfProfilesOnTablesTableName);

            grantPrivilege.SetData(SystemeConstants.InsertPrivilegeName, profileName, targetDatabase.databaseName, SystemeConstants.PrivilegesTableName);
            Assert.IsFalse(grantPrivilege.ValidateParameters());
        }