Exemple #1
0
        // helper methods
        public void DropCollection()
        {
            var operation = new DropCollectionOperation(_collectionNamespace, _messageEncoderSettings);

            using (var binding = SuiteConfiguration.GetReadWriteBinding())
            {
                operation.Execute(binding);
            }
        }
Exemple #2
0
        // helper methods
        private void DropCollection()
        {
            var operation = new DropCollectionOperation(_collectionNamespace, _messageEncoderSettings);

            using (var binding = CoreTestConfiguration.GetReadWriteBinding())
            {
                operation.Execute(binding, CancellationToken.None);
            }
        }
Exemple #3
0
        // helper methods
        private void EnsureTestData()
        {
            if (_testDataHasBeenCreated)
            {
                return;
            }

            using (var binding = SuiteConfiguration.GetReadWriteBinding())
            {
                var dropCollectionOperation = new DropCollectionOperation(_collectionNamespace, _messageEncoderSettings);
                dropCollectionOperation.Execute(binding);

                var requests = Enumerable.Range(1, 5)
                               .Select(id => new BsonDocument("_id", id))
                               .Select(document => new InsertRequest(document));
                var insertOperation = new BulkInsertOperation(_collectionNamespace, requests, _messageEncoderSettings);
                insertOperation.Execute(binding);
            }

            _testDataHasBeenCreated = true;
        }
        // helper methods
        private void EnsureCollectionDoesNotExist(IWriteBinding binding, CollectionNamespace collectionNamespace)
        {
            var operation = new DropCollectionOperation(collectionNamespace, _messageEncoderSettings);

            operation.Execute(binding);
        }