Exemplo n.º 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);
        }
Exemplo n.º 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);
        }
Exemplo n.º 3
0
 public static IBsonSerializer <BsonDocument> _documentSerializer(this ChangeStreamCursor <BsonDocument> cursor)
 {
     return((IBsonSerializer <BsonDocument>)Reflector.GetFieldValue(cursor, nameof(_documentSerializer)));
 }
Exemplo n.º 4
0
 public static bool _disposed(this ChangeStreamCursor <BsonDocument> cursor)
 {
     return((bool)Reflector.GetFieldValue(cursor, nameof(_disposed)));
 }
Exemplo n.º 5
0
 public static IAsyncCursor <RawBsonDocument> _cursor(this ChangeStreamCursor <BsonDocument> cursor)
 {
     return((IAsyncCursor <RawBsonDocument>)Reflector.GetFieldValue(cursor, nameof(_cursor)));
 }
Exemplo n.º 6
0
 public static IEnumerable <BsonDocument> _current(this ChangeStreamCursor <BsonDocument> cursor)
 {
     return((IEnumerable <BsonDocument>)Reflector.GetFieldValue(cursor, nameof(_current)));
 }
Exemplo n.º 7
0
 public static IChangeStreamOperation <BsonDocument> _changeStreamOperation(this ChangeStreamCursor <BsonDocument> cursor)
 {
     return((IChangeStreamOperation <BsonDocument>)Reflector.GetFieldValue(cursor, nameof(_changeStreamOperation)));
 }
Exemplo n.º 8
0
 public static IReadBinding _binding(this ChangeStreamCursor <BsonDocument> cursor)
 {
     return((IReadBinding)Reflector.GetFieldValue(cursor, nameof(_binding)));
 }
Exemplo n.º 9
0
        public static IBsonSerializer <BsonDocument> _documentSerializer(this ChangeStreamCursor <BsonDocument> cursor)
        {
            var fieldInfo = typeof(ChangeStreamCursor <BsonDocument>).GetField("_documentSerializer", BindingFlags.NonPublic | BindingFlags.Instance);

            return((IBsonSerializer <BsonDocument>)fieldInfo.GetValue(cursor));
        }
Exemplo n.º 10
0
        public static bool _disposed(this ChangeStreamCursor <BsonDocument> cursor)
        {
            var fieldInfo = typeof(ChangeStreamCursor <BsonDocument>).GetField("_disposed", BindingFlags.NonPublic | BindingFlags.Instance);

            return((bool)fieldInfo.GetValue(cursor));
        }
Exemplo n.º 11
0
        public static IAsyncCursor <RawBsonDocument> _cursor(this ChangeStreamCursor <BsonDocument> cursor)
        {
            var fieldInfo = typeof(ChangeStreamCursor <BsonDocument>).GetField("_cursor", BindingFlags.NonPublic | BindingFlags.Instance);

            return((IAsyncCursor <RawBsonDocument>)fieldInfo.GetValue(cursor));
        }
Exemplo n.º 12
0
        public static IEnumerable <BsonDocument> _current(this ChangeStreamCursor <BsonDocument> cursor)
        {
            var fieldInfo = typeof(ChangeStreamCursor <BsonDocument>).GetField("_current", BindingFlags.NonPublic | BindingFlags.Instance);

            return((IEnumerable <BsonDocument>)fieldInfo.GetValue(cursor));
        }
Exemplo n.º 13
0
        public static IChangeStreamOperation <BsonDocument> _changeStreamOperation(this ChangeStreamCursor <BsonDocument> cursor)
        {
            var fieldInfo = typeof(ChangeStreamCursor <BsonDocument>).GetField("_changeStreamOperation", BindingFlags.NonPublic | BindingFlags.Instance);

            return((IChangeStreamOperation <BsonDocument>)fieldInfo.GetValue(cursor));
        }
Exemplo n.º 14
0
        public static IReadBinding _binding(this ChangeStreamCursor <BsonDocument> cursor)
        {
            var fieldInfo = typeof(ChangeStreamCursor <BsonDocument>).GetField("_binding", BindingFlags.NonPublic | BindingFlags.Instance);

            return((IReadBinding)fieldInfo.GetValue(cursor));
        }
        public static BsonDocument _resumeToken(this ChangeStreamCursor <BsonDocument> cursor)
        {
            var fieldInfo = typeof(ChangeStreamCursor <BsonDocument>).GetField("_resumeToken", BindingFlags.NonPublic | BindingFlags.Instance);

            return((BsonDocument)fieldInfo.GetValue(cursor));
        }