Skip to content

Commit ce56009

Browse files
committed
Update cosmosclient createion
1 parent 95a0f3e commit ce56009

1 file changed

Lines changed: 13 additions & 11 deletions

File tree

Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.EmulatorTests/CFP/AllVersionsAndDeletes/BuilderWithCustomSerializerTests.cs

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -684,19 +684,21 @@ public async Task WhenADocumentIsCreatedThenUpdatedThenDeletedTestsAsyncLiveAcco
684684

685685
private async Task WhenADocumentIsCreatedThenUpdatedThenDeletedTestsAsync(bool propertyNameCaseInsensitive, bool isMultiMaster = false)
686686
{
687-
string accountEndpoint = isMultiMaster ?
688-
TestCommon.GetMultiRegionConnectionString() :
689-
null;
687+
(string defaultEndpoint, string authKey) = TestCommon.GetAccountInfo();
688+
string accountEndpoint = TestCommon.GetMultiRegionConnectionString();
690689

691-
CosmosClient cosmosClient = TestCommon.CreateCosmosClient((cosmosClientBuilder) =>
692-
cosmosClientBuilder.WithSystemTextJsonSerializerOptions(
693-
new JsonSerializerOptions()
694-
{
695-
PropertyNameCaseInsensitive = propertyNameCaseInsensitive
696-
}),
697-
useCustomSeralizer: false,
698-
accountEndpointOverride: accountEndpoint);
690+
CosmosClientOptions options = new CosmosClientOptions()
691+
{
692+
UseSystemTextJsonSerializerWithOptions = new JsonSerializerOptions()
693+
{
694+
PropertyNameCaseInsensitive = propertyNameCaseInsensitive
695+
}
696+
};
699697

698+
CosmosClient cosmosClient = isMultiMaster
699+
? new CosmosClient(accountEndpoint, options)
700+
: new CosmosClient(accountEndpoint, authKey, options);
701+
700702
Database database = await cosmosClient.CreateDatabaseIfNotExistsAsync(id: Guid.NewGuid().ToString());
701703
Container leaseContainer = await database.CreateContainerIfNotExistsAsync(containerProperties: new ContainerProperties(id: "leases", partitionKeyPath: "/id"));
702704
ContainerInternal monitoredContainer = await this.CreateMonitoredContainer(ChangeFeedMode.AllVersionsAndDeletes, database);

0 commit comments

Comments
 (0)