public void GetEncoder_should_return_encoder()
        {
            var mockEncoder = Substitute.For<IMessageEncoder<DeleteMessage>>();
            var mockEncoderFactory = Substitute.For<IMessageEncoderFactory>();
            mockEncoderFactory.GetDeleteMessageEncoder().Returns(mockEncoder);

            var subject = new DeleteMessage(1, _collectionNamespace, new BsonDocument("x", 1), true);
            var encoder = subject.GetEncoder(mockEncoderFactory);
            encoder.Should().BeSameAs(mockEncoder);
        }
        public void GetEncoder_should_return_encoder()
        {
            var subject = new DeleteMessage(1, _collectionNamespace, new BsonDocument("x", 1), true);
            var stubEncoderFactory = Substitute.For<IMessageEncoderFactory>();
            var stubEncoder = Substitute.For<IMessageEncoder>();
            stubEncoderFactory.GetDeleteMessageEncoder().Returns(stubEncoder);

            var result = subject.GetEncoder(stubEncoderFactory);

            result.Should().BeSameAs(stubEncoder);
        }
Ejemplo n.º 3
0
        public void GetEncoder_should_return_encoder()
        {
            var subject = new DeleteMessage(1, _collectionNamespace, new BsonDocument("x", 1), true);
            var mockEncoderFactory = new Mock<IMessageEncoderFactory>();
            var encoder = new Mock<IMessageEncoder>().Object;
            mockEncoderFactory.Setup(f => f.GetDeleteMessageEncoder()).Returns(encoder);

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

            result.Should().BeSameAs(encoder);
        }
Ejemplo n.º 4
0
        public void GetEncoder_should_return_encoder()
        {
            var subject            = new DeleteMessage(1, _collectionNamespace, new BsonDocument("x", 1), true);
            var stubEncoderFactory = Substitute.For <IMessageEncoderFactory>();
            var stubEncoder        = Substitute.For <IMessageEncoder>();

            stubEncoderFactory.GetDeleteMessageEncoder().Returns(stubEncoder);

            var result = subject.GetEncoder(stubEncoderFactory);

            result.Should().BeSameAs(stubEncoder);
        }
Ejemplo n.º 5
0
        public void GetEncoder_should_return_encoder()
        {
            var subject            = new DeleteMessage(1, _collectionNamespace, new BsonDocument("x", 1), true);
            var mockEncoderFactory = new Mock <IMessageEncoderFactory>();
            var encoder            = new Mock <IMessageEncoder>().Object;

            mockEncoderFactory.Setup(f => f.GetDeleteMessageEncoder()).Returns(encoder);

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

            result.Should().BeSameAs(encoder);
        }
Ejemplo n.º 6
0
        public void GetEncoder_should_return_encoder()
        {
            var mockEncoder        = Substitute.For <IMessageEncoder <DeleteMessage> >();
            var mockEncoderFactory = Substitute.For <IMessageEncoderFactory>();

            mockEncoderFactory.GetDeleteMessageEncoder().Returns(mockEncoder);

            var subject = new DeleteMessage(1, "database", "collection", new BsonDocument("x", 1), true);
            var encoder = subject.GetEncoder(mockEncoderFactory);

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