© 2026 Hedgehog Software, LLC
System.ArgumentException: Format of the initialization string does not conform to specification starting at index 0.
public abstract class IntegrationTest { protected readonly HttpClient TestClient; protected CosmosDbContainer cosmosDbContainer; protected IntegrationTest() { cosmosDbContainer = new CosmosDbBuilder() .WithImage("mcr.microsoft.com/cosmosdb/linux/azure-cosmos-emulator:latest") .Build(); cosmosDbContainer.StartAsync().GetAwaiter().GetResult(); var appFactory = new WebApplicationFactory<Program>() .WithWebHostBuilder(builder => { builder.ConfigureServices(services => { var connectionString = cosmosDbContainer.GetConnectionString(); var cosmosOptions = new CosmosClientOptions() { Serializer = new CosmosJsonSerializer() }; services.RemoveAll(typeof(CosmosClient)); services.AddSingleton(new CosmosClient(connectionString, cosmosOptions)); }); builder.UseEnvironment("Development"); }); TestClient = appFactory.CreateClient(); } public void Dispose() { cosmosDbContainer.DisposeAsync(); } }