コード例 #1
0
        public void Constructor_should_initialize_instance()
        {
            var subject = new InsertMessage <BsonDocument>(_requestId, _collectionNamespace, _serializer, _documentSource, _maxBatchCount, _maxMessageSize, _continueOnError);

            subject.CollectionNamespace.Should().Be(_collectionNamespace);
            subject.ContinueOnError.Should().Be(_continueOnError);
            subject.DocumentSource.Should().BeSameAs(_documentSource);
            subject.MaxBatchCount.Should().Be(_maxBatchCount);
            subject.MaxMessageSize.Should().Be(_maxMessageSize);
            subject.RequestId.Should().Be(_requestId);
            subject.Serializer.Should().BeSameAs(_serializer);
        }
コード例 #2
0
        public void GetEncoder_should_return_encoder()
        {
            var subject            = new InsertMessage <BsonDocument>(_requestId, _collectionNamespace, _serializer, _documentSource, _maxBatchCount, _maxMessageSize, _continueOnError);
            var mockEncoderFactory = new Mock <IMessageEncoderFactory>();
            var encoder            = new Mock <IMessageEncoder>().Object;

            mockEncoderFactory.Setup(f => f.GetInsertMessageEncoder(_serializer)).Returns(encoder);

            var result = subject.GetEncoder(mockEncoderFactory.Object);

            result.Should().BeSameAs(encoder);
        }
コード例 #3
0
        public void GetEncoder_should_return_encoder()
        {
            var mockEncoder        = Substitute.For <IMessageEncoder <InsertMessage <BsonDocument> > >();
            var mockEncoderFactory = Substitute.For <IMessageEncoderFactory>();

            mockEncoderFactory.GetInsertMessageEncoder(_serializer).Returns(mockEncoder);

            var subject = new InsertMessage <BsonDocument>(_requestId, _collectionNamespace, _serializer, _documentSource, _maxBatchCount, _maxMessageSize, _continueOnError);
            var encoder = subject.GetEncoder(mockEncoderFactory);

            encoder.Should().BeSameAs(mockEncoder);
        }