예제 #1
0
        public async Task WhenCosmosStoreInitialised_ThenDatabaseAndCollectionIsCreated()
        {
            _serviceProvider.GetService <ICosmosStore <Cat> >();

            var database = await _cosmonautClient.GetDatabaseAsync(_databaseId);

            var collection = await _cosmonautClient.GetCollectionAsync(_databaseId, _collectionName);

            database.Should().NotBeNull();
            database.Id.Should().Be(_databaseId);
            collection.Should().NotBeNull();
            collection.Id.Should().Be(_collectionName);
        }
예제 #2
0
        public async Task <bool> EnsureCreatedAsync(string databaseId)
        {
            var database = await _cosmonautClient.GetDatabaseAsync(databaseId);

            if (database != null)
            {
                return(false);
            }

            var newDatabase = new Database {
                Id = databaseId
            };

            database = await _cosmonautClient.CreateDatabaseAsync(newDatabase);

            return(database != null);
        }
        public async Task <bool> EnsureCreatedAsync(string databaseId, int?databaseThroughput = null)
        {
            var database = await _cosmonautClient.GetDatabaseAsync(databaseId);

            if (database != null)
            {
                return(false);
            }

            var newDatabase = new Database {
                Id = databaseId
            };

            database = await _cosmonautClient.CreateDatabaseAsync(newDatabase, new RequestOptions
            {
                OfferThroughput = databaseThroughput
            });

            return(database != null);
        }