// helper methods
        private void DropCollection()
        {
            var operation = new DropCollectionOperation(_collectionNamespace, _messageEncoderSettings);

            using (var binding = CoreTestConfiguration.GetReadWriteBinding())
            {
                operation.ExecuteAsync(binding, CancellationToken.None).GetAwaiter().GetResult();
            }
        }
Ejemplo n.º 2
0
        public async Task ExecuteAsync_should_not_throw_when_collection_does_not_exist()
        {
            using (var binding = SuiteConfiguration.GetReadWriteBinding())
            {
                var subject = new DropCollectionOperation(_collectionNamespace, _messageEncoderSettings);
                var dropCollectionOperation = new DropCollectionOperation(_collectionNamespace, _messageEncoderSettings);
                await dropCollectionOperation.ExecuteAsync(binding, CancellationToken.None);

                await subject.ExecuteAsync(binding, CancellationToken.None); // this will throw if we have a problem...
            }
        }
        public async Task ExecuteAsync_should_not_throw_when_collection_does_not_exist()
        {
            using (var binding = SuiteConfiguration.GetReadWriteBinding())
            {
                var subject = new DropCollectionOperation(_collectionNamespace, _messageEncoderSettings);
                var dropCollectionOperation = new DropCollectionOperation(_collectionNamespace, _messageEncoderSettings);
                await dropCollectionOperation.ExecuteAsync(binding);

                Func <Task> action = async() => { await subject.ExecuteAsync(binding); };

                action.ShouldNotThrow();
            }
        }
Ejemplo n.º 4
0
        public async Task ExecuteAsync_should_return_expected_result()
        {
            using (var binding = SuiteConfiguration.GetReadWriteBinding())
            {
                var subject = new DropCollectionOperation(_collectionNamespace, _messageEncoderSettings);
                var createCollectionOperation = new CreateCollectionOperation(_collectionNamespace, _messageEncoderSettings);
                await createCollectionOperation.ExecuteAsync(binding, CancellationToken.None);

                var result = await subject.ExecuteAsync(binding, CancellationToken.None);

                result["ok"].ToBoolean().Should().BeTrue();
                result["ns"].ToString().Should().Be(_collectionNamespace.FullName);
            }
        }
Ejemplo n.º 5
0
        // helper methods
        public Task DropCollectionAsync(IWriteBinding binding)
        {
            var operation = new DropCollectionOperation(_collectionNamespace, _messageEncoderSettings);

            return(operation.ExecuteAsync(binding, CancellationToken.None));
        }
Ejemplo n.º 6
0
        // helper methods
        private void EnsureCollectionDoesNotExist(IWriteBinding binding, CollectionNamespace collectionNamespace)
        {
            var operation = new DropCollectionOperation(collectionNamespace, _messageEncoderSettings);

            operation.ExecuteAsync(binding, CancellationToken.None).GetAwaiter().GetResult();
        }