public void WriteMessage_should_throw_if_textWriter_was_not_provided()
 {
     using (var textReader = new StringReader(""))
     {
         var    subject = new QueryMessageJsonEncoder(textReader, null, __messageEncoderSettings);
         Action action  = () => subject.WriteMessage(__testMessage);
         action.ShouldThrow <InvalidOperationException>();
     }
 }
 public void WriteMessage_should_throw_if_message_is_null()
 {
     using (var textWriter = new StringWriter())
     {
         var    subject = new QueryMessageJsonEncoder(null, textWriter, __messageEncoderSettings);
         Action action  = () => subject.WriteMessage(null);
         action.ShouldThrow <ArgumentNullException>();
     }
 }
 public void WriteMessage_should_write_a_message()
 {
     using (var textWriter = new StringWriter())
     {
         var subject = new QueryMessageJsonEncoder(null, textWriter, __messageEncoderSettings);
         subject.WriteMessage(__testMessage);
         var json = textWriter.ToString();
         json.Should().Be(__testMessageJson);
     }
 }
Esempio n. 4
0
 public void WriteMessage_should_throw_if_jsonWriter_was_not_provided()
 {
     using (var stringReader = new StringReader(""))
         using (var jsonReader = new JsonReader(stringReader))
         {
             var    subject = new QueryMessageJsonEncoder(jsonReader, null);
             Action action  = () => subject.WriteMessage(__testMessage);
             action.ShouldThrow <InvalidOperationException>();
         }
 }
Esempio n. 5
0
 public void WriteMessage_should_write_a_message()
 {
     using (var stringWriter = new StringWriter())
         using (var jsonWriter = new JsonWriter(stringWriter))
         {
             var subject = new QueryMessageJsonEncoder(null, jsonWriter);
             subject.WriteMessage(__testMessage);
             var json = stringWriter.ToString();
             json.Should().Be(__testMessageJson);
         }
 }
 public void WriteMessage_should_write_a_message()
 {
     using (var textWriter = new StringWriter())
     {
         var subject = new QueryMessageJsonEncoder(null, textWriter, __messageEncoderSettings);
         subject.WriteMessage(__testMessage);
         var json = textWriter.ToString();
         json.Should().Be(__testMessageJson);
     }
 }
 public void WriteMessage_should_throw_if_textWriter_was_not_provided()
 {
     using (var textReader = new StringReader(""))
     {
         var subject = new QueryMessageJsonEncoder(textReader, null, __messageEncoderSettings);
         Action action = () => subject.WriteMessage(__testMessage);
         action.ShouldThrow<InvalidOperationException>();
     }
 }
 public void WriteMessage_should_throw_if_message_is_null()
 {
     using (var textWriter = new StringWriter())
     {
         var subject = new QueryMessageJsonEncoder(null, textWriter, __messageEncoderSettings);
         Action action = () => subject.WriteMessage(null);
         action.ShouldThrow<ArgumentNullException>();
     }
 }