public void ReadMessage_should_throw_if_textReader_was_not_provided()
 {
     using (var textWriter = new StringWriter())
     {
         var    subject = new QueryMessageJsonEncoder(null, textWriter, __messageEncoderSettings);
         Action action  = () => subject.ReadMessage();
         action.ShouldThrow <InvalidOperationException>();
     }
 }
Esempio n. 2
0
 public void ReadMessage_should_throw_if_jsonReader_was_not_provided()
 {
     using (var stringWriter = new StringWriter())
         using (var jsonWriter = new JsonWriter(stringWriter))
         {
             var    subject = new QueryMessageJsonEncoder(null, jsonWriter);
             Action action  = () => subject.ReadMessage();
             action.ShouldThrow <InvalidOperationException>();
         }
 }
 public void ReadMessage_should_read_a_message()
 {
     using (var textReader = new StringReader(__testMessageJson))
     {
         var subject = new QueryMessageJsonEncoder(textReader, null, __messageEncoderSettings);
         var message = subject.ReadMessage();
         message.CollectionNamespace.Should().Be(__collectionNamespace);
         message.AwaitData.Should().Be(__awaitData);
         message.BatchSize.Should().Be(__batchSize);
         message.Fields.Should().Be(__fields);
         message.NoCursorTimeout.Should().Be(__noCursorTimeout);
         message.PartialOk.Should().Be(__partialOk);
         message.Query.Should().Be(__query);
         message.RequestId.Should().Be(__requestId);
         message.Skip.Should().Be(__skip);
         message.SlaveOk.Should().Be(__slaveOk);
         message.TailableCursor.Should().Be(__tailableCursor);
     }
 }
 public void ReadMessage_should_throw_if_textReader_was_not_provided()
 {
     using (var textWriter = new StringWriter())
     {
         var subject = new QueryMessageJsonEncoder(null, textWriter, __messageEncoderSettings);
         Action action = () => subject.ReadMessage();
         action.ShouldThrow<InvalidOperationException>();
     }
 }
 public void ReadMessage_should_read_a_message()
 {
     using (var textReader = new StringReader(__testMessageJson))
     {
         var subject = new QueryMessageJsonEncoder(textReader, null, __messageEncoderSettings);
         var message = subject.ReadMessage();
         message.CollectionNamespace.Should().Be(__collectionNamespace);
         message.AwaitData.Should().Be(__awaitData);
         message.BatchSize.Should().Be(__batchSize);
         message.Fields.Should().Be(__fields);
         message.NoCursorTimeout.Should().Be(__noCursorTimeout);
         message.PartialOk.Should().Be(__partialOk);
         message.Query.Should().Be(__query);
         message.RequestId.Should().Be(__requestId);
         message.Skip.Should().Be(__skip);
         message.SlaveOk.Should().Be(__slaveOk);
         message.TailableCursor.Should().Be(__tailableCursor);
     }
 }