@@ -88,18 +88,27 @@ protected async Task BeginOracleTransactionAsync()
8888
8989 protected async Task BeginPostgreSQLTransactionAsync ( )
9090 {
91+ using var cts = new CancellationTokenSource ( TimeSpan . FromSeconds ( 10 ) ) ;
9192 var configReader = new ConfigurationReader ( ) ;
92- var connectionString = configReader . GetDatabaseConnectionConfigById ( DatabaseConnectionConfigIds . PostgreSQL )
93- ? . ConnectionString ;
93+
94+ var databaseConnectionConfig = configReader . GetDatabaseConnectionConfigById ( DatabaseConnectionConfigIds . PostgreSQL ) ;
95+
96+ var connectionString = databaseConnectionConfig ? . ConnectionString ;
9497
9598 if ( string . IsNullOrEmpty ( connectionString ) )
9699 {
97- throw new IgnoreException ( "No Postgre ConnectionString is Set ." ) ;
100+ throw new IgnoreException ( "No Postgre SQL connection string is set ." ) ;
98101 }
99102
100103 DbProviderFactories . RegisterFactory ( "Npgsql" , ( ) => Npgsql . NpgsqlFactory . Instance ) ;
101104
102- Provider = new PostgreSQLTransformationProvider ( new PostgreSQLDialect ( ) , connectionString , null , "default" , "Npgsql" ) ;
105+ using var container = new Container ( ) ;
106+ container . RegisterDatabaseIntegrationTestService ( ) ;
107+ var databaseIntegrationTestServiceFactory = container . Resolve < IDatabaseIntegrationTestServiceFactory > ( ) ;
108+ var postgreIntegrationTestService = databaseIntegrationTestServiceFactory . Create ( DatabaseProviderType . Postgres ) ;
109+ var databaseInfo = await postgreIntegrationTestService . CreateTestDatabaseAsync ( databaseConnectionConfig , cts . Token ) ;
110+
111+ Provider = new PostgreSQLTransformationProvider ( new PostgreSQLDialect ( ) , databaseInfo . DatabaseConnectionConfig . ConnectionString , null , "default" , "Npgsql" ) ;
103112 Provider . BeginTransaction ( ) ;
104113
105114 await Task . CompletedTask ;
0 commit comments