Exemple #1
0
 public void WriteMessage_should_throw_if_textWriter_was_not_provided()
 {
     using (var textReader = new StringReader(""))
     {
         var    subject = new UpdateMessageJsonEncoder(textReader, null, __messageEncoderSettings);
         Action action  = () => subject.WriteMessage(__testMessage);
         action.ShouldThrow <InvalidOperationException>();
     }
 }
Exemple #2
0
 public void WriteMessage_should_throw_if_message_is_null()
 {
     using (var textWriter = new StringWriter())
     {
         var    subject = new UpdateMessageJsonEncoder(null, textWriter, __messageEncoderSettings);
         Action action  = () => subject.WriteMessage(null);
         action.ShouldThrow <ArgumentNullException>();
     }
 }
Exemple #3
0
 public void WriteMessage_should_write_a_message()
 {
     using (var textWriter = new StringWriter())
     {
         var subject = new UpdateMessageJsonEncoder(null, textWriter, __messageEncoderSettings);
         subject.WriteMessage(__testMessage);
         var json = textWriter.ToString();
         json.Should().Be(__testMessageJson);
     }
 }
Exemple #4
0
 public void WriteMessage_should_throw_if_message_is_null()
 {
     using (var stringWriter = new StringWriter())
         using (var jsonWriter = new JsonWriter(stringWriter))
         {
             var    subject = new UpdateMessageJsonEncoder(null, jsonWriter);
             Action action  = () => subject.WriteMessage(null);
             action.ShouldThrow <ArgumentNullException>();
         }
 }
Exemple #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 UpdateMessageJsonEncoder(jsonReader, null);
             Action action  = () => subject.WriteMessage(__testMessage);
             action.ShouldThrow <InvalidOperationException>();
         }
 }
Exemple #6
0
 public void WriteMessage_should_write_a_message()
 {
     using (var stringWriter = new StringWriter())
         using (var jsonWriter = new JsonWriter(stringWriter))
         {
             var subject = new UpdateMessageJsonEncoder(null, jsonWriter);
             subject.WriteMessage(__testMessage);
             var json = stringWriter.ToString();
             json.Should().Be(__testMessageJson);
         }
 }
Exemple #7
0
 public void ReadMessage_should_read_a_message()
 {
     using (var textReader = new StringReader(__testMessageJson))
     {
         var subject = new UpdateMessageJsonEncoder(textReader, null, __messageEncoderSettings);
         var message = subject.ReadMessage();
         message.CollectionNamespace.Should().Be(__collectionNamespace);
         message.IsMulti.Should().Be(__isMulti);
         message.IsUpsert.Should().Be(__isUpsert);
         message.Query.Should().Be(__query);
         message.RequestId.Should().Be(__requestId);
         message.Update.Should().Be(__update);
     }
 }
Exemple #8
0
 public void ReadMessage_should_read_a_message()
 {
     using (var stringReader = new StringReader(__testMessageJson))
         using (var jsonReader = new JsonReader(stringReader))
         {
             var subject = new UpdateMessageJsonEncoder(jsonReader, null);
             var message = subject.ReadMessage();
             message.DatabaseName.Should().Be(__databaseName);
             message.CollectionName.Should().Be(__collectionName);
             message.IsMulti.Should().Be(__isMulti);
             message.IsUpsert.Should().Be(__isUpsert);
             message.Query.Should().Be(__query);
             message.RequestId.Should().Be(__requestId);
             message.Update.Should().Be(__update);
         }
 }
 public void WriteMessage_should_write_a_message()
 {
     using (var textWriter = new StringWriter())
     {
         var subject = new UpdateMessageJsonEncoder(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 UpdateMessageJsonEncoder(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 UpdateMessageJsonEncoder(null, textWriter, __messageEncoderSettings);
         Action action = () => subject.WriteMessage(null);
         action.ShouldThrow<ArgumentNullException>();
     }
 }
 public void ReadMessage_should_read_a_message()
 {
     using (var textReader = new StringReader(__testMessageJson))
     {
         var subject = new UpdateMessageJsonEncoder(textReader, null, __messageEncoderSettings);
         var message = subject.ReadMessage();
         message.CollectionNamespace.Should().Be(__collectionNamespace);
         message.IsMulti.Should().Be(__isMulti);
         message.IsUpsert.Should().Be(__isUpsert);
         message.Query.Should().Be(__query);
         message.RequestId.Should().Be(__requestId);
         message.Update.Should().Be(__update);
     }
 }