1515namespace ManagedCode . Database . Tests . TestContainers ;
1616
1717[ CollectionDefinition ( nameof ( CosmosTestContainer ) ) ]
18- public class CosmosTestContainer : ITestContainer < string , TestCosmosItem > ,
18+ public class CosmosTestContainer : ITestContainer < string , TestCosmosItem > ,
1919 ICollectionFixture < CosmosTestContainer > , IDisposable
2020{
2121 private readonly TestcontainersContainer _cosmosTestContainer ;
@@ -83,21 +83,22 @@ public async Task InitializeAsync()
8383 var listContainers = await _dockerClient . Containers . ListContainersAsync ( new ContainersListParameters ( ) ) ;
8484
8585 ContainerListResponse containerListResponse = listContainers . FirstOrDefault ( container => container . Names . Contains ( $ "/{ containerName } ") ) ;
86-
87- if ( containerListResponse != null )
86+
87+ if ( containerListResponse != null )
8888 {
8989 publicPort = containerListResponse . Ports . Single ( port => port . PrivatePort == privatePort ) . PublicPort ;
9090
9191 containerId = containerListResponse . ID ;
9292 }
9393 }
9494
95+
9596 _database = new CosmosDatabase ( new CosmosOptions
9697 {
9798 ConnectionString =
9899 $ "AccountEndpoint=https://localhost:{ publicPort } /;AccountKey=C2y6yDjf5/R+ob0N8A7Cgv30VRDJIWEHLM+4QDU5DE2nQ9nDuVTqobD4b8mGGyPMbIZnqyMsEcaGQy67XIw/Jw==",
99100 DatabaseName = "database" ,
100- CollectionName = $ "testContainers ",
101+ CollectionName = $ "testContainer ",
101102 AllowTableCreation = true ,
102103 CosmosClientOptions = new CosmosClientOptions ( )
103104 {
@@ -120,7 +121,7 @@ public async Task InitializeAsync()
120121
121122 public async Task DisposeAsync ( )
122123 {
123- await _database . DeleteAsync ( ) ;
124+ // await _database.DeleteAsync();
124125 await _database . DisposeAsync ( ) ;
125126
126127 /* _testOutputHelper.WriteLine($"Cosmos container State:{_cosmosContainer.State}");
0 commit comments