public void DropSecurityProfile_TheProfileCannotDrop_NoticeInValidate() { IDatabaseContainer databaseContainer = ObjectConstructor.CreateDatabaseContainer(); DropSecurityProfile dropSecurityProfile = CreateDropSecurityProfile(databaseContainer, SystemeConstants.SystemDatabaseName, SystemeConstants.ProfilesTableName); dropSecurityProfile.SetTargetSecurityProfile(SystemeConstants.DefaultProfile); Assert.IsFalse(dropSecurityProfile.ValidateParameters()); }
public void DropSecurityProfile_TheProfileDoesntExist_NoticeInValidate() { IDatabaseContainer databaseContainer = ObjectConstructor.CreateDatabaseContainer(); Column column = databaseContainer.GetDatabase(SystemeConstants.SystemDatabaseName).GetTable(SystemeConstants.ProfilesTableName).GetColumn(SystemeConstants.ProfileNameColumn); string profileName = VariousFunctions.GenerateRandomString(8); while (column.ExistCells(profileName)) { profileName = VariousFunctions.GenerateRandomString(8); } DropSecurityProfile dropSecurityProfile = CreateDropSecurityProfile(databaseContainer, SystemeConstants.SystemDatabaseName, SystemeConstants.ProfilesTableName); dropSecurityProfile.SetTargetSecurityProfile(profileName); Assert.IsFalse(dropSecurityProfile.ValidateParameters()); }
public void DropSecurity_TheProfileCanDrop_DropTheProfile() { IDatabaseContainer databaseContainer = ObjectConstructor.CreateDatabaseContainer(); 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); } Row row = table.CreateRowDefinition(); row.GetCell(SystemeConstants.ProfileNameColumn).data = profileName; table.AddRow(row); int numberOfRow = table.GetRowCount(); DropSecurityProfile dropSecurityProfile = CreateDropSecurityProfile(databaseContainer, SystemeConstants.SystemDatabaseName, SystemeConstants.ProfilesTableName); dropSecurityProfile.SetTargetSecurityProfile(profileName); Assert.IsTrue(dropSecurityProfile.ValidateParameters()); dropSecurityProfile.Execute(); Assert.AreEqual(numberOfRow - 1, table.GetRowCount()); }