File tree Expand file tree Collapse file tree 4 files changed +14
-11
lines changed
Expand file tree Collapse file tree 4 files changed +14
-11
lines changed Original file line number Diff line number Diff line change @@ -19,10 +19,9 @@ public abstract class LiveControllerTests<TEntity> : BaseTest where TEntity : cl
1919 protected virtual bool CanRunLiveTests ( ) => true ;
2020
2121 /// <summary>
22- /// Some tests require the ability to run math queries. This method returns true if the
23- /// service can run those tests. Notably, Cosmos can't run those tests.
22+ /// The driver name - used for skipping tests when the driver doesn't support a feature.
2423 /// </summary>
25- protected virtual bool CanRunMathQueryTests ( ) => true ;
24+ protected virtual string DriverName { get ; } = "Default" ;
2625
2726 /// <summary>
2827 /// The actual test class must provide an implementation that retrieves the entity through
Original file line number Diff line number Diff line change @@ -26,14 +26,17 @@ public AzureSQL_Controller_Tests(DatabaseFixture fixture, ITestOutputHelper outp
2626 this . connectionString = Environment . GetEnvironmentVariable ( "DATASYNC_AZSQL_CONNECTIONSTRING" ) ;
2727 if ( ! string . IsNullOrEmpty ( this . connectionString ) )
2828 {
29- Context = AzureSqlDbContext . CreateContext ( this . connectionString , output , clearEntities : this . _fixture . AzureSqlIsInitialized ) ;
29+ output . WriteLine ( $ "AzureSqlIsInitialized = { this . _fixture . AzureSqlIsInitialized } ") ;
30+ Context = AzureSqlDbContext . CreateContext ( this . connectionString , output , clearEntities : ! this . _fixture . AzureSqlIsInitialized ) ;
3031 this . movies = [ .. Context . Movies . AsNoTracking ( ) ] ;
3132 this . _fixture . AzureSqlIsInitialized = true ;
3233 }
3334 }
3435
3536 private AzureSqlDbContext Context { get ; set ; }
3637
38+ protected override string DriverName { get ; } = "AzureSQL" ;
39+
3740 protected override bool CanRunLiveTests ( ) => ! string . IsNullOrEmpty ( this . connectionString ) ;
3841
3942 protected override Task < AzureSqlEntityMovie > GetEntityAsync ( string id )
Original file line number Diff line number Diff line change @@ -29,20 +29,18 @@ public Cosmos_Controller_Tests(DatabaseFixture fixture, ITestOutputHelper output
2929 // Note: we don't clear entities on every run to speed up the test runs. This can only be done because
3030 // the tests are read-only (associated with the query and get capabilities). If the test being run writes
3131 // to the database then change clearEntities to true.
32- Context = CosmosDbContext . CreateContext ( this . connectionString , output , clearEntities : this . _fixture . CosmosIsInitialized ) ;
32+ output . WriteLine ( $ "CosmosIsInitialized = { this . _fixture . CosmosIsInitialized } ") ;
33+ Context = CosmosDbContext . CreateContext ( this . connectionString , output , clearEntities : ! this . _fixture . CosmosIsInitialized ) ;
3334 this . movies = [ .. Context . Movies . AsNoTracking ( ) ] ;
3435 this . _fixture . CosmosIsInitialized = true ;
3536 }
3637 }
3738
3839 private CosmosDbContext Context { get ; set ; }
3940
40- protected override bool CanRunLiveTests ( ) => ! string . IsNullOrEmpty ( this . connectionString ) ;
41+ protected override string DriverName { get ; } = "Cosmos" ;
4142
42- /// <summary>
43- /// There are a set of tests that are not supported by CosmosDB, so we disable them
44- /// </summary>
45- protected override bool CanRunMathQueryTests ( ) => false ;
43+ protected override bool CanRunLiveTests ( ) => ! string . IsNullOrEmpty ( this . connectionString ) ;
4644
4745 protected override Task < CosmosEntityMovie > GetEntityAsync ( string id )
4846 => Task . FromResult ( Context . Movies . AsNoTracking ( ) . SingleOrDefault ( m => m . Id == id ) ) ;
Original file line number Diff line number Diff line change @@ -26,14 +26,17 @@ public PgSQL_Controller_Tests(DatabaseFixture fixture, ITestOutputHelper output)
2626 this . connectionString = Environment . GetEnvironmentVariable ( "DATASYNC_PGSQL_CONNECTIONSTRING" ) ;
2727 if ( ! string . IsNullOrEmpty ( this . connectionString ) )
2828 {
29- Context = PgDbContext . CreateContext ( this . connectionString , output , clearEntities : this . _fixture . PgIsInitialized ) ;
29+ output . WriteLine ( $ "PgIsInitialized = { this . _fixture . PgIsInitialized } ") ;
30+ Context = PgDbContext . CreateContext ( this . connectionString , output , clearEntities : ! this . _fixture . PgIsInitialized ) ;
3031 this . movies = Context . Movies . AsNoTracking ( ) . ToList ( ) ;
3132 this . _fixture . PgIsInitialized = true ;
3233 }
3334 }
3435
3536 private PgDbContext Context { get ; set ; }
3637
38+ protected override string DriverName { get ; } = "PgSQL" ;
39+
3740 protected override bool CanRunLiveTests ( ) => ! string . IsNullOrEmpty ( this . connectionString ) ;
3841
3942 protected override Task < PgEntityMovie > GetEntityAsync ( string id )
You can’t perform that action at this time.
0 commit comments