@@ -603,18 +603,18 @@ protected Test2Context()
603603
604604 public class CosmosNonSharedSessionTokenTests ( NonSharedFixture fixture ) : NonSharedModelTestBase ( fixture ) , IClassFixture < NonSharedFixture >
605605 {
606- protected override ITestStoreFactory TestStoreFactory
606+ protected override ITestStoreFactory NonSharedTestStoreFactory
607607 => CosmosTestStoreFactory . Instance ;
608608
609- protected override string StoreName => nameof ( CosmosSessionTokensTest ) ;
609+ protected override string NonSharedStoreName => nameof ( CosmosSessionTokensTest ) ;
610610
611- protected override TestStore CreateTestStore ( ) => CosmosTestStore . Create ( StoreName , ( cfg ) => cfg . SessionTokenManagementMode ( Cosmos . Infrastructure . SessionTokenManagementMode . SemiAutomatic ) ) ;
611+ protected override TestStore CreateTestStore ( ) => CosmosTestStore . Create ( NonSharedStoreName , ( cfg ) => cfg . SessionTokenManagementMode ( Cosmos . Infrastructure . SessionTokenManagementMode . SemiAutomatic ) ) ;
612612
613613 [ ConditionalFact ]
614614 public virtual async Task UseSessionTokens_uses_session_tokens ( )
615615 {
616- var contextFactory = await InitializeAsync < CosmosSessionTokenContext > ( ) ;
617- using var context = contextFactory . CreateContext ( ) ;
616+ var contextFactory = await InitializeNonSharedTest < CosmosSessionTokenContext > ( ) ;
617+ using var context = contextFactory . CreateDbContext ( ) ;
618618
619619 context . Customers . Add ( new Customer { Id = "1" , PartitionKey = "1" } ) ;
620620 context . OtherContainerCustomers . Add ( new OtherContainerCustomer { Id = "1" , PartitionKey = "1" } ) ;
@@ -646,8 +646,8 @@ await Assert.ThrowsAsync<CosmosException>(() => context.OtherContainerCustomers.
646646 [ ConditionalFact ]
647647 public virtual async Task ReadItem_does_not_exist_returns_null ( )
648648 {
649- var contextFactory = await InitializeAsync < CosmosSessionTokenContext > ( ) ;
650- using var context = contextFactory . CreateContext ( ) ;
649+ var contextFactory = await InitializeNonSharedTest < CosmosSessionTokenContext > ( ) ;
650+ using var context = contextFactory . CreateDbContext ( ) ;
651651
652652 var result = await context . Customers . FirstOrDefaultAsync ( x => x . Id == "nonexistent" && x . PartitionKey == "nonexistent" ) ;
653653
@@ -657,8 +657,8 @@ public virtual async Task ReadItem_does_not_exist_returns_null()
657657 [ ConditionalFact ]
658658 public virtual async Task Read_item_session_not_found_throws_CosmosException ( )
659659 {
660- var contextFactory = await InitializeAsync < CosmosSessionTokenContext > ( ) ;
661- using var context = contextFactory . CreateContext ( ) ;
660+ var contextFactory = await InitializeNonSharedTest < CosmosSessionTokenContext > ( ) ;
661+ using var context = contextFactory . CreateDbContext ( ) ;
662662
663663 context . Customers . Add ( new Customer { Id = "1" , PartitionKey = "1" } ) ;
664664 context . OtherContainerCustomers . Add ( new OtherContainerCustomer { Id = "1" , PartitionKey = "1" } ) ;
@@ -690,11 +690,11 @@ await Assert.ThrowsAsync<CosmosException>(() => context.OtherContainerCustomers.
690690 [ ConditionalFact ]
691691 public virtual async Task New_context_does_not_use_same_SessionTokenStorage ( )
692692 {
693- var contextFactory = await InitializeAsync < CosmosSessionTokenContext > ( ) ;
694- using var context = contextFactory . CreateContext ( ) ;
693+ var contextFactory = await InitializeNonSharedTest < CosmosSessionTokenContext > ( ) ;
694+ using var context = contextFactory . CreateDbContext ( ) ;
695695 context . Database . UseSessionToken ( "A" ) ;
696696
697- using var newContext = contextFactory . CreateContext ( ) ;
697+ using var newContext = contextFactory . CreateDbContext ( ) ;
698698 Assert . NotSame ( context , newContext ) ;
699699 Assert . Null ( newContext . Database . GetSessionToken ( ) ) ;
700700 Assert . Equal ( "A" , context . Database . GetSessionToken ( ) ) ;
@@ -704,17 +704,17 @@ public virtual async Task New_context_does_not_use_same_SessionTokenStorage()
704704 [ ConditionalFact ]
705705 public virtual async Task Pooled_context_uses_same_SessionTokenStorage ( )
706706 {
707- var contextFactory = await InitializeAsync < CosmosSessionTokenContext > ( ) ;
707+ var contextFactory = await InitializeNonSharedTest < CosmosSessionTokenContext > ( ) ;
708708 DbContext contextCopy ;
709709 ISessionTokenStorage sessionTokenStorageCopy ;
710- using ( var context = contextFactory . CreateContext ( ) )
710+ using ( var context = contextFactory . CreateDbContext ( ) )
711711 {
712712 contextCopy = context ;
713713 context . Database . UseSessionToken ( "A" ) ;
714714 sessionTokenStorageCopy = ( ( CosmosDatabaseWrapper ) context . GetService < IDatabase > ( ) ) . SessionTokenStorage ;
715715 }
716716
717- using var newContext = contextFactory . CreateContext ( ) ;
717+ using var newContext = contextFactory . CreateDbContext ( ) ;
718718
719719 Assert . Same ( newContext , contextCopy ) ;
720720 Assert . Same ( sessionTokenStorageCopy , ( ( CosmosDatabaseWrapper ) newContext . GetService < IDatabase > ( ) ) . SessionTokenStorage ) ;
@@ -724,17 +724,17 @@ public virtual async Task Pooled_context_uses_same_SessionTokenStorage()
724724 [ ConditionalFact ]
725725 public virtual async Task Pooled_context_clears_SessionTokenStorage ( )
726726 {
727- var contextFactory = await InitializeAsync < CosmosSessionTokenContext > ( addServices : services => services . Replace ( ServiceDescriptor . Singleton < ISessionTokenStorageFactory , TestSessionTokenStorageFactory > ( ) ) ) ;
727+ var contextFactory = await InitializeNonSharedTest < CosmosSessionTokenContext > ( addServices : services => services . Replace ( ServiceDescriptor . Singleton < ISessionTokenStorageFactory , TestSessionTokenStorageFactory > ( ) ) ) ;
728728 DbContext contextCopy ;
729729 ISessionTokenStorage sessionTokenStorageCopy ;
730- using ( var context = contextFactory . CreateContext ( ) )
730+ using ( var context = contextFactory . CreateDbContext ( ) )
731731 {
732732 contextCopy = context ;
733733 sessionTokenStorageCopy = ( ( CosmosDatabaseWrapper ) context . GetService < IDatabase > ( ) ) . SessionTokenStorage ;
734734 _sessionTokenStorage . ClearCalled = false ;
735735 }
736736
737- using var newContext = contextFactory . CreateContext ( ) ;
737+ using var newContext = contextFactory . CreateDbContext ( ) ;
738738
739739 Assert . Same ( newContext , contextCopy ) ;
740740 Assert . Same ( sessionTokenStorageCopy , ( ( CosmosDatabaseWrapper ) newContext . GetService < IDatabase > ( ) ) . SessionTokenStorage ) ;
0 commit comments