예제 #1
0
        public void constructor_should_initialize_instance()
        {
            var cursor                = new Mock <IAsyncCursor <RawBsonDocument> >().Object;
            var documentSerializer    = new Mock <IBsonSerializer <BsonDocument> >().Object;
            var binding               = new Mock <IReadBinding>().Object;
            var initialOperationTime  = new BsonTimestamp(3L);
            var postBatchResumeToken  = new BsonDocument("c", 3);
            var changeStreamOperation = CreateChangeStreamOperation();
            var startAfter            = new BsonDocument("a", 1);
            var resumeAfter           = new BsonDocument("b", 2);
            var startAtOperationTime  = BsonTimestamp.Create(3L);

            var subject = new ChangeStreamCursor <BsonDocument>(cursor, documentSerializer, binding, changeStreamOperation, postBatchResumeToken, initialOperationTime, startAfter, resumeAfter, startAtOperationTime);

            subject._binding().Should().BeSameAs(binding);
            subject._changeStreamOperation().Should().BeSameAs(changeStreamOperation);
            subject._current().Should().BeNull();
            subject._cursor().Should().BeSameAs(cursor);
            subject._disposed().Should().BeFalse();
            subject._documentSerializer().Should().BeSameAs(documentSerializer);
            subject._postBatchResumeToken().Should().BeSameAs(postBatchResumeToken);
            subject._initialOperationTime().Should().BeSameAs(initialOperationTime);
            subject._initialStartAfter().Should().Be(startAfter);
            subject._initialResumeAfter().Should().Be(resumeAfter);
            subject._initialStartAtOperationTime().Should().Be(startAtOperationTime);
        }
예제 #2
0
        public void constructor_should_initialize_instance()
        {
            var cursor                = new Mock <IAsyncCursor <RawBsonDocument> >().Object;
            var documentSerializer    = new Mock <IBsonSerializer <BsonDocument> >().Object;
            var binding               = new Mock <IReadBinding>().Object;
            var changeStreamOperation = CreateChangeStreamOperation();

            var subject = new ChangeStreamCursor <BsonDocument>(cursor, documentSerializer, binding, changeStreamOperation);

            subject._binding().Should().BeSameAs(binding);
            subject._changeStreamOperation().Should().BeSameAs(changeStreamOperation);
            subject._current().Should().BeNull();
            subject._cursor().Should().BeSameAs(cursor);
            subject._disposed().Should().BeFalse();
            subject._documentSerializer().Should().BeSameAs(documentSerializer);
        }