コード例 #1
0
        public static void CreateClient_Creates_Client_From_Service_Provider_With_Locations()
        {
            // Arrange
            var options = new UserStoreOptions()
            {
                ServiceUri      = new Uri("https://cosmosdb.azure.local"),
                AccessKey       = "bpfYUKmfV0arChaIPI3hU3+bn3w=",
                DatabaseName    = "my-database",
                CollectionName  = "my-collection",
                CurrentLocation = "UK South",
            };

            var services = new ServiceCollection()
                           .AddHttpClient()
                           .AddSingleton(Options.Create(new JsonOptions()))
                           .AddSingleton(options);

            using var serviceProvider = services.BuildServiceProvider();

            // Act
            using CosmosClient actual = DocumentHelpers.CreateClient(serviceProvider);

            // Assert
            actual.ShouldNotBeNull();
        }