public void DbConfigConnectionString_WithDefaultDbTypeSetToOracle_ShouldBeCorrectConnectionString(SupportedDatabaseTypes?configDbType, string expectedConnectionString) { lock (TestCollectionFixtures.LockObj) { try { var configuration = GetConfiguration(configDbType); DefaultDbConfigValues.WithOracleDefaultDbType(); DefaultDbConfigValues.WithEmptyAdminUserAndPassword(); var dbConfig = configuration.CreateDbConfig(); dbConfig.ConnectionString.Should().Be(expectedConnectionString); var useridStr = configDbType == SupportedDatabaseTypes.Postgres ? "username" : "user id"; dbConfig.AdminUser.Should().BeNull(); dbConfig.AdminPassword.Should().BeNull(); dbConfig.AdminConnectionString.ContainsIgnoreCase($"{useridStr}=;").Should().BeTrue(); dbConfig.AdminConnectionString.ContainsIgnoreCase("password=;").Should().BeTrue(); } finally { DefaultDbConfigValues.WithLibraryDefaultDbType(); DefaultDbConfigValues.WithLibraryDefaultAdminUserAndPassword(); } } }
public void DbConfigDbType_WithDefaultDbTypeSetToOracle_ShouldBeCorrectDbType(SupportedDatabaseTypes?configDbType, SupportedDatabaseTypes expectedDbType) { lock (TestCollectionFixtures.LockObj) { try { var configuration = GetConfiguration(configDbType); DefaultDbConfigValues.WithOracleDefaultDbType(); configuration.CreateDbConfig().DbType.Should().Be(expectedDbType); } finally { DefaultDbConfigValues.WithLibraryDefaultDbType(); } } }
public void MigrationConfig_WithoutConfiguration_ShouldNotFail() { DefaultDbConfigValues.WithOracleDefaultDbType(); var migrationConfig = new MsDbMigrationConfig(null); Action action = () => { var dbConfig = migrationConfig.GetDbConfig(); var value = dbConfig.AdminConnectionString; value = dbConfig.ConnectionString; value = dbConfig.ConfigurationDelimiter; value = dbConfig.User; value = dbConfig.Password; value = dbConfig.AdminUser; value = dbConfig.AdminPassword; value = dbConfig.ConnectionTimeoutInSecs; value = dbConfig.Datasource; value = dbConfig.Hostname; value = dbConfig.DatabaseName; value = dbConfig.Port; value = dbConfig.Pooling.ToString(); value = dbConfig.Schema; value = migrationConfig.Schema; value = migrationConfig.SchemaPassword; value = migrationConfig.DatabaseName; value = migrationConfig.ConnectionString; value = migrationConfig.DatabaseOwner; value = migrationConfig.TempTablespace; value = migrationConfig.ProcessorId; value = migrationConfig.GetMigrationName(); value = migrationConfig.GetSchemaPrefixId(); value = migrationConfig.GetSchemaPrefixUniqueId(); migrationConfig.GetConfiguration().Should().BeNull(); }; action.Should().NotThrow(); }