当前位置: 首页>>代码示例>>C#>>正文


C# FindOperation.CreateFindOpcodeOperation方法代码示例

本文整理汇总了C#中FindOperation.CreateFindOpcodeOperation方法的典型用法代码示例。如果您正苦于以下问题:C# FindOperation.CreateFindOpcodeOperation方法的具体用法?C# FindOperation.CreateFindOpcodeOperation怎么用?C# FindOperation.CreateFindOpcodeOperation使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在FindOperation的用法示例。


在下文中一共展示了FindOperation.CreateFindOpcodeOperation方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: CreateFindOpcodeOperation_should_return_expected_result_when_singleBatch_is_true

        public void CreateFindOpcodeOperation_should_return_expected_result_when_singleBatch_is_true()
        {
            var subject = new FindOperation<BsonDocument>(_collectionNamespace, BsonDocumentSerializer.Instance, _messageEncoderSettings);
            subject.Limit = 1;
            subject.SingleBatch = true;

            var result = subject.CreateFindOpcodeOperation();

            result.Limit.Should().Be(-subject.Limit);
        }
开发者ID:narutoswj,项目名称:mongo-csharp-driver,代码行数:10,代码来源:FindOperationTests.cs

示例2: CreateFindOpcodeOperation_should_throw_when_ReadConcern_is_not_server_default

        public void CreateFindOpcodeOperation_should_throw_when_ReadConcern_is_not_server_default()
        {
            var subject = new FindOperation<BsonDocument>(_collectionNamespace, BsonDocumentSerializer.Instance, _messageEncoderSettings)
            {
                ReadConcern = new ReadConcern(ReadConcernLevel.Local)
            };

            var exception = Record.Exception(() => { subject.CreateFindOpcodeOperation(); });

            exception.Should().BeOfType<MongoClientException>();
        }
开发者ID:mfidemraizer,项目名称:mongo-csharp-driver,代码行数:11,代码来源:FindOperationTests.cs

示例3: CreateFindOpcodeOperation_should_return_expected_result

        public void CreateFindOpcodeOperation_should_return_expected_result()
        {
            var subject = new FindOperation<BsonDocument>(_collectionNamespace, BsonDocumentSerializer.Instance, _messageEncoderSettings);
            subject.AllowPartialResults = true;
            subject.BatchSize = 1;
            subject.Comment = "comment";
            subject.CursorType = CursorType.Tailable;
            subject.Filter = new BsonDocument("filter", 1);
            subject.FirstBatchSize = 2;
            subject.Hint = "x_1";
            subject.Limit = 3;
            subject.Max = new BsonDocument("max", 1);
            subject.MaxScan = 4;
            subject.MaxTime = TimeSpan.FromSeconds(1);
            subject.Min = new BsonDocument("min", 1);
            subject.NoCursorTimeout = true;
            subject.OplogReplay = true;
            subject.Projection = new BsonDocument("projection", 1);
            subject.ReadConcern = ReadConcern.Local;
            subject.ReturnKey = true;
            subject.ShowRecordId = true;
            subject.SingleBatch = false;
            subject.Skip = 6;
            subject.Snapshot = true;
            subject.Sort = new BsonDocument("sort", 1);

            var result = subject.CreateFindOpcodeOperation();

            result.AllowPartialResults.Should().Be(subject.AllowPartialResults);
            result.BatchSize.Should().Be(subject.BatchSize);
            result.CollectionNamespace.Should().Be(subject.CollectionNamespace);
            result.Comment.Should().Be(subject.Comment);
            result.CursorType.Should().Be(subject.CursorType);
            result.Filter.Should().Be(subject.Filter);
            result.FirstBatchSize.Should().Be(subject.FirstBatchSize);
            result.Hint.Should().Be(subject.Hint);
            result.Limit.Should().Be(subject.Limit);
            result.Max.Should().Be(subject.Max);
            result.MaxScan.Should().Be(subject.MaxScan);
            result.MaxTime.Should().Be(subject.MaxTime);
            result.MessageEncoderSettings.Should().BeSameAs(subject.MessageEncoderSettings);
            result.Min.Should().Be(subject.Min);
            result.Modifiers.Should().Be(subject.Modifiers);
            result.NoCursorTimeout.Should().Be(subject.NoCursorTimeout);
            result.OplogReplay.Should().Be(subject.OplogReplay);
            result.Projection.Should().Be(subject.Projection);
            result.ResultSerializer.Should().Be(subject.ResultSerializer);
            result.ShowRecordId.Should().Be(subject.ShowRecordId);
            result.Skip.Should().Be(subject.Skip);
            result.Snapshot.Should().Be(subject.Snapshot);
            result.Sort.Should().Be(subject.Sort);
        }
开发者ID:narutoswj,项目名称:mongo-csharp-driver,代码行数:52,代码来源:FindOperationTests.cs

示例4: CreateFindOpcodeOperation_should_throw_when_Collation_is_set

        public void CreateFindOpcodeOperation_should_throw_when_Collation_is_set()
        {
            var subject = new FindOperation<BsonDocument>(_collectionNamespace, BsonDocumentSerializer.Instance, _messageEncoderSettings)
            {
                Collation = new Collation("en_US")
            };

            var exception = Record.Exception(() => { subject.CreateFindOpcodeOperation(); });

            exception.Should().BeOfType<NotSupportedException>();
        }
开发者ID:mfidemraizer,项目名称:mongo-csharp-driver,代码行数:11,代码来源:FindOperationTests.cs


注:本文中的FindOperation.CreateFindOpcodeOperation方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。