public void CreateSecurityProfile_ProfileDoenstExits_CreateProfile() { IDatabaseContainer databaseContainer = ObjectConstructor.CreateDatabaseContainer(); CreateSecurityProfile query = CreateCreateSecurityProfile(databaseContainer); ITable table = databaseContainer.GetDatabase(SystemeConstants.SystemDatabaseName).GetTable(SystemeConstants.ProfilesTableName); Column column = table.GetColumn(SystemeConstants.ProfileNameColumn); string profileName = VariousFunctions.GenerateRandomString(8); while (column.ExistCells(profileName)) { profileName = VariousFunctions.GenerateRandomString(8); } query.SetProfileName(profileName); Assert.IsTrue(query.ValidateParameters()); query.Execute(); Assert.IsTrue(column.ExistCells(profileName)); }
public void RevokePrivilege_AllParamsExistsButTheCombinationIsNotValid_NoticeInValidate() { //Prefase IDatabaseContainer databaseContainer = ObjectConstructor.CreateDatabaseContainer(); CreateSecurityProfile createSecurityProfile = TestCreateSecurityProfile.CreateCreateSecurityProfile(databaseContainer); Column profileNamesColumn = databaseContainer.GetDatabase(SystemeConstants.SystemDatabaseName).GetTable(SystemeConstants.ProfilesTableName).GetColumn(SystemeConstants.ProfileNameColumn); string profileName = VariousFunctions.GenerateRandomString(8); while (profileNamesColumn.ExistCells(profileName)) { profileName = VariousFunctions.GenerateRandomString(8); } createSecurityProfile.SetProfileName(profileName); createSecurityProfile.ValidateParameters(); createSecurityProfile.Execute(); //TEST RevoquePrivilege revoquePrivilege = CreateRevokePrivilege(databaseContainer, SystemeConstants.SystemDatabaseName, SystemeConstants.PrivilegesOfProfilesOnTablesTableName); revoquePrivilege.SetData(profileName, SystemeConstants.SystemDatabaseName, SystemeConstants.ProfilesTableName, SystemeConstants.InsertPrivilegeName); Assert.IsFalse(revoquePrivilege.ValidateParameters()); }