public void WriteMessage_should_throw_if_message_is_null() { using (var stream = new MemoryStream()) { var subject = new KillCursorsMessageBinaryEncoder(stream, __messageEncoderSettings); Action action = () => subject.WriteMessage(null); action.ShouldThrow <ArgumentNullException>(); } }
public void WriteMessage_should_write_a_message() { using (var stream = new MemoryStream()) { var subject = new KillCursorsMessageBinaryEncoder(stream, __messageEncoderSettings); subject.WriteMessage(__testMessage); var bytes = stream.ToArray(); bytes.Should().Equal(__testMessageBytes); } }
public void WriteMessage_should_throw_if_binaryWriter_was_not_provided() { using (var stream = new MemoryStream()) using (var binaryReader = new BsonBinaryReader(stream)) { var subject = new KillCursorsMessageBinaryEncoder(binaryReader, null); Action action = () => subject.WriteMessage(__testMessage); action.ShouldThrow <InvalidOperationException>(); } }
public void WriteMessage_should_write_a_message() { using (var stream = new MemoryStream()) { var subject = new KillCursorsMessageBinaryEncoder(stream, __messageEncoderSettings); subject.WriteMessage(__testMessage); var bytes = stream.ToArray(); bytes.Should().Equal(__testMessageBytes); } }
public void WriteMessage_should_throw_if_message_is_null() { using (var stream = new MemoryStream()) { var subject = new KillCursorsMessageBinaryEncoder(stream, __messageEncoderSettings); Action action = () => subject.WriteMessage(null); action.ShouldThrow<ArgumentNullException>(); } }
public void WriteMessage_should_throw_if_binaryWriter_was_not_provided() { using (var stream = new MemoryStream()) using (var binaryReader = new BsonBinaryReader(stream)) { var subject = new KillCursorsMessageBinaryEncoder(binaryReader, null); Action action = () => subject.WriteMessage(__testMessage); action.ShouldThrow<InvalidOperationException>(); } }