Esempio n. 1
0
 public void WriteMessage_should_throw_if_message_is_null()
 {
     using (var textWriter = new StringWriter())
     {
         var    subject = new KillCursorsMessageJsonEncoder(null, textWriter, __messageEncoderSettings);
         Action action  = () => subject.WriteMessage(null);
         action.ShouldThrow <ArgumentNullException>();
     }
 }
Esempio n. 2
0
 public void WriteMessage_should_throw_if_textWriter_was_not_provided()
 {
     using (var textReader = new StringReader(""))
     {
         var    subject = new KillCursorsMessageJsonEncoder(textReader, null, __messageEncoderSettings);
         Action action  = () => subject.WriteMessage(__testMessage);
         action.ShouldThrow <InvalidOperationException>();
     }
 }
Esempio n. 3
0
 public void ReadMessage_should_read_a_message()
 {
     using (var textReader = new StringReader(__testMessageJson))
     {
         var subject = new KillCursorsMessageJsonEncoder(textReader, null, __messageEncoderSettings);
         var message = subject.ReadMessage();
         message.CursorIds.Should().Equal(__cursorIds);
         message.RequestId.Should().Be(__testMessage.RequestId);
     }
 }
Esempio n. 4
0
 public void WriteMessage_should_write_a_message()
 {
     using (var textWriter = new StringWriter())
     {
         var subject = new KillCursorsMessageJsonEncoder(null, textWriter, __messageEncoderSettings);
         subject.WriteMessage(__testMessage);
         var json = textWriter.ToString();
         json.Should().Be(__testMessageJson);
     }
 }
Esempio n. 5
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 KillCursorsMessageJsonEncoder(jsonReader, null);
             Action action  = () => subject.WriteMessage(__testMessage);
             action.ShouldThrow <InvalidOperationException>();
         }
 }
Esempio n. 6
0
 public void WriteMessage_should_write_a_message()
 {
     using (var stringWriter = new StringWriter())
         using (var jsonWriter = new JsonWriter(stringWriter))
         {
             var subject = new KillCursorsMessageJsonEncoder(null, jsonWriter);
             subject.WriteMessage(__testMessage);
             var json = stringWriter.ToString();
             json.Should().Be(__testMessageJson);
         }
 }
 public void ReadMessage_should_read_a_message()
 {
     using (var textReader = new StringReader(__testMessageJson))
     {
         var subject = new KillCursorsMessageJsonEncoder(textReader, null, __messageEncoderSettings);
         var message = subject.ReadMessage();
         message.CursorIds.Should().Equal(__cursorIds);
         message.RequestId.Should().Be(__testMessage.RequestId);
     }
 }
 public void WriteMessage_should_write_a_message()
 {
     using (var textWriter = new StringWriter())
     {
         var subject = new KillCursorsMessageJsonEncoder(null, textWriter, __messageEncoderSettings);
         subject.WriteMessage(__testMessage);
         var json = textWriter.ToString();
         json.Should().Be(__testMessageJson);
     }
 }
 public void WriteMessage_should_throw_if_message_is_null()
 {
     using (var textWriter = new StringWriter())
     {
         var subject = new KillCursorsMessageJsonEncoder(null, textWriter, __messageEncoderSettings);
         Action action = () => subject.WriteMessage(null);
         action.ShouldThrow<ArgumentNullException>();
     }
 }
 public void WriteMessage_should_throw_if_textWriter_was_not_provided()
 {
     using (var textReader = new StringReader(""))
     {
         var subject = new KillCursorsMessageJsonEncoder(textReader, null, __messageEncoderSettings);
         Action action = () => subject.WriteMessage(__testMessage);
         action.ShouldThrow<InvalidOperationException>();
     }
 }
 public void WriteMessage_should_write_a_message()
 {
     using (var stringWriter = new StringWriter())
     using (var jsonWriter = new JsonWriter(stringWriter))
     {
         var subject = new KillCursorsMessageJsonEncoder(null, jsonWriter);
         subject.WriteMessage(__testMessage);
         var json = stringWriter.ToString();
         json.Should().Be(__testMessageJson);
     }
 }
 public void WriteMessage_should_throw_if_jsonWriter_was_not_provided()
 {
     using (var stringReader = new StringReader(""))
     using (var jsonReader = new JsonReader(stringReader))
     {
         var subject = new KillCursorsMessageJsonEncoder(jsonReader, null);
         Action action = () => subject.WriteMessage(__testMessage);
         action.ShouldThrow<InvalidOperationException>();
     }
 }