예제 #1
0
 public void WriteMessage_should_throw_if_textWriter_was_not_provided()
 {
     using (var textReader = new StringReader(""))
     {
         var    subject = new ReplyMessageJsonEncoder <BsonDocument>(textReader, null, __messageEncoderSettings, __serializer);
         Action action  = () => subject.WriteMessage(__testMessage);
         action.ShouldThrow <InvalidOperationException>();
     }
 }
예제 #2
0
 public void WriteMessage_should_throw_if_message_is_null()
 {
     using (var textWriter = new StringWriter())
     {
         var    subject = new ReplyMessageJsonEncoder <BsonDocument>(null, textWriter, __messageEncoderSettings, __serializer);
         Action action  = () => subject.WriteMessage(null);
         action.ShouldThrow <ArgumentNullException>();
     }
 }
예제 #3
0
 public void WriteMessage_should_write_a_query_failure_message()
 {
     using (var textWriter = new StringWriter())
     {
         var subject = new ReplyMessageJsonEncoder <BsonDocument>(null, textWriter, __messageEncoderSettings, __serializer);
         subject.WriteMessage(__queryFailureMessage);
         var json = textWriter.ToString();
         json.Should().Be(__queryFailureMessageJson);
     }
 }
예제 #4
0
 public void WriteMessage_should_write_a_message()
 {
     using (var stringWriter = new StringWriter())
         using (var jsonWriter = new JsonWriter(stringWriter))
         {
             var subject = new ReplyMessageJsonEncoder <BsonDocument>(null, jsonWriter, __serializer);
             subject.WriteMessage(__testMessage);
             var json = stringWriter.ToString();
             json.Should().Be(__testMessageJson);
         }
 }