public void MasterPasswordUpdateTest() { var newFavorite = this.AddFavoriteWithTestPassword(); var rdpOptions = newFavorite.ProtocolProperties as IContainsCredentials; var guardedOptions = new GuardedSecurity(this.PrimaryPersistence, rdpOptions.GetSecurity()); guardedOptions.Password = VALIDATION_VALUE; this.PrimaryFavorites.Update(newFavorite); DatabasePasswordUpdate.UpdateMastrerPassord(settings.ConnectionString, string.Empty, VALIDATION_VALUE_B); settings.DatabaseMasterPassword = VALIDATION_VALUE_B; bool result = DatabaseConnections.TestConnection(); Assert.IsTrue(result, "Couldn't update database master password"); // the secondary persistence has to reflect the database password change ((SqlPersistenceSecurity)this.SecondaryPersistence.Security).UpdateDatabaseKey(); IFavorite resultFavorite = this.SecondaryFavorites.FirstOrDefault(); var resolvedSecurity = new GuardedSecurity(this.SecondaryPersistence, resultFavorite.Security); Assert.AreEqual(VALIDATION_VALUE, resolvedSecurity.Password, "Favorite password doesn't match after database password update."); var secondaryRdpOptions = resultFavorite.ProtocolProperties as IContainsCredentials; var resolvedOptionsSecurity = new GuardedSecurity(this.SecondaryPersistence, secondaryRdpOptions.GetSecurity()); Assert.AreEqual(VALIDATION_VALUE, resolvedOptionsSecurity.Password, "Favorite TS gateway password doesn't match after database password update."); }
private TestConnectionResult TrySetNewDatabasePassword(object state) { var connectionProperties = state as Tuple <string, string, string>; return(DatabasePasswordUpdate.UpdateMastrerPassord(connectionProperties.Item1, connectionProperties.Item2, connectionProperties.Item3)); }
public void ExportImportFavoriteTest() { IPersistence persistence = this.PrimaryPersistence; DatabasePasswordUpdate.UpdateMastrerPassord(settings.ConnectionString, string.Empty, VALIDATION_VALUE_B); settings.DatabaseMasterPassword = VALIDATION_VALUE_B; ((SqlPersistenceSecurity)persistence.Security).UpdateDatabaseKey(); string filePath = this.TestContext.DeploymentDirectory; Integrations.ImportsTest.ExportImportFavorite(persistence, filePath); }