예제 #1
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);
        }
예제 #2
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);
        }