public void Seek_should_call_wrapped_stream()
        {
            var stream = Substitute.For<Stream>();
            var subject = new BsonStreamAdapter(stream);
            var offset = 1L;
            var origin = SeekOrigin.Current;
            var newPosition = 2L;
            stream.Seek(offset, origin).Returns(newPosition);

            var result = subject.Seek(offset, origin);

            result.Should().Be(newPosition);
            stream.Received(1).Seek(offset, origin);
        }
        public void Seek_should_throw_when_subject_is_disposed()
        {
            var stream = Substitute.For<Stream>();
            var subject = new BsonStreamAdapter(stream);
            var offset = 1L;
            var origin = SeekOrigin.Current;
            subject.Dispose();

            Action action = () => subject.Seek(offset, origin);

            action.ShouldThrow<ObjectDisposedException>().And.ObjectName.Should().Be("BsonStreamAdapter");
        }
        public void Seek_should_call_wrapped_stream()
        {
            var mockStream = new Mock<Stream>();
            var subject = new BsonStreamAdapter(mockStream.Object);
            var offset = 1L;
            var origin = SeekOrigin.Current;
            var newPosition = 2L;
            mockStream.Setup(s => s.Seek(offset, origin)).Returns(newPosition);

            var result = subject.Seek(offset, origin);

            result.Should().Be(newPosition);
            mockStream.Verify(s => s.Seek(offset, origin), Times.Once);
        }