コード例 #1
0
 public void ReadMessage_should_throw_if_textReader_was_not_provided()
 {
     using (var textWriter = new StringWriter())
     {
         var    subject = new ReplyMessageJsonEncoder <BsonDocument>(null, textWriter, __messageEncoderSettings, __serializer);
         Action action  = () => subject.ReadMessage();
         action.ShouldThrow <InvalidOperationException>();
     }
 }
コード例 #2
0
 public void ReadMessage_should_read_a_query_failure_message()
 {
     using (var textReader = new StringReader(__queryFailureMessageJson))
     {
         var subject = new ReplyMessageJsonEncoder <BsonDocument>(textReader, null, __messageEncoderSettings, __serializer);
         var message = subject.ReadMessage();
         message.AwaitCapable.Should().Be(false);
         message.CursorId.Should().Be(__cursorId);
         message.CursorNotFound.Should().Be(true);
         message.Documents.Should().BeNull();
         message.NumberReturned.Should().Be(0);
         message.QueryFailure.Should().Be(true);
         message.QueryFailureDocument.Should().Be(__queryFailureDocument);
         message.Serializer.Should().BeSameAs(__serializer);
         message.StartingFrom.Should().Be(0);
         message.RequestId.Should().Be(__requestId);
         message.ResponseTo.Should().Be(__responseTo);
     }
 }
コード例 #3
0
 public void ReadMessage_should_read_a_message()
 {
     using (var stringReader = new StringReader(__testMessageJson))
         using (var jsonReader = new JsonReader(stringReader))
         {
             var subject = new ReplyMessageJsonEncoder <BsonDocument>(jsonReader, null, __serializer);
             var message = subject.ReadMessage();
             message.AwaitCapable.Should().Be(__awaitCapable);
             message.CursorId.Should().Be(__cursorId);
             message.CursorNotFound.Should().Be(__cursorNotFound);
             message.Documents.Should().Equal(__documents);
             message.NumberReturned.Should().Be(__numberReturned);
             message.QueryFailure.Should().Be(false);
             message.QueryFailureDocument.Should().Be(null);
             message.Serializer.Should().BeSameAs(__serializer);
             message.StartingFrom.Should().Be(__startingFrom);
             message.RequestId.Should().Be(__requestId);
             message.ResponseTo.Should().Be(__responseTo);
         }
 }