コード例 #1
0
 protected async Task <TResult> ExecuteOperationAsync <TResult>(IReadOperation <TResult> operation)
 {
     using (var binding = CoreTestConfiguration.GetReadBinding())
     {
         return(await ExecuteOperationAsync(operation, binding));
     }
 }
コード例 #2
0
 protected TResult ExecuteOperation <TResult>(IReadOperation <TResult> operation)
 {
     using (var binding = CoreTestConfiguration.GetReadBinding())
     {
         return(operation.Execute(binding, CancellationToken.None));
     }
 }
コード例 #3
0
 protected async Task <TResult> ExecuteOperationAsync <TResult>(IReadOperation <TResult> operation)
 {
     using (var binding = CoreTestConfiguration.GetReadBinding())
     {
         return(await operation.ExecuteAsync(binding, CancellationToken.None));
     }
 }
コード例 #4
0
 protected async Task <TResult> ExecuteOperationAsync <TResult>(IReadOperation <TResult> operation)
 {
     using (var binding = CoreTestConfiguration.GetReadBinding(_session.Fork()))
         using (var bindingHandle = new ReadBindingHandle(binding))
         {
             return(await ExecuteOperationAsync(operation, bindingHandle));
         }
 }
コード例 #5
0
 protected TResult ExecuteOperation <TResult>(IReadOperation <TResult> operation)
 {
     using (var binding = CoreTestConfiguration.GetReadBinding(_session.Fork()))
         using (var bindingHandle = new ReadBindingHandle(binding))
         {
             return(operation.Execute(bindingHandle, CancellationToken.None));
         }
 }
コード例 #6
0
        public async Task ExecuteAsync_should_return_expected_result()
        {
            var subject = new CountOperation(_collectionNamespace, _messageEncoderSettings);

            long result;

            using (var binding = CoreTestConfiguration.GetReadBinding())
            {
                result = await subject.ExecuteAsync(binding, CancellationToken.None);
            }

            result.Should().Be(5);
        }
コード例 #7
0
        public async Task ExecuteAsync_should_return_expected_result_when_filter_is_provided()
        {
            var subject = new CountOperation(_collectionNamespace, _messageEncoderSettings);

            subject.Filter = BsonDocument.Parse("{ _id : { $gt : 1 } }");

            long result;

            using (var binding = CoreTestConfiguration.GetReadBinding())
            {
                result = await subject.ExecuteAsync(binding, CancellationToken.None);
            }

            result.Should().Be(4);
        }