public void WriteMessage_should_throw_if_message_is_null() { using (var stream = new MemoryStream()) { var subject = new DeleteMessageBinaryEncoder(stream, null); Action action = () => subject.WriteMessage(null); action.ShouldThrow <ArgumentNullException>(); } }
public void WriteMessage_should_write_a_message() { using (var stream = new MemoryStream()) { var subject = new DeleteMessageBinaryEncoder(stream, null); 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 DeleteMessageBinaryEncoder(binaryReader, null); Action action = () => subject.WriteMessage(__testMessage); action.ShouldThrow <InvalidOperationException>(); } }
public void WriteMessage_should_encode_flags_correctly(int flags, bool isMulti) { var message = new DeleteMessage(__requestId, __collectionNamespace, __query, isMulti); using (var stream = new MemoryStream()) { var subject = new DeleteMessageBinaryEncoder(stream, null); subject.WriteMessage(message); var bytes = stream.ToArray(); bytes[__flagsOffset].Should().Be((byte)flags); } }
public void WriteMessage_should_write_a_message() { using (var stream = new MemoryStream()) using (var binaryWriter = new BsonBinaryWriter(stream)) { var subject = new DeleteMessageBinaryEncoder(null, binaryWriter); 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()) using (var binaryWriter = new BsonBinaryWriter(stream)) { var subject = new DeleteMessageBinaryEncoder(null, binaryWriter); 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 DeleteMessageBinaryEncoder(binaryReader, null); Action action = () => subject.WriteMessage(__testMessage); action.ShouldThrow<InvalidOperationException>(); } }
public void WriteMessage_should_encode_flags_correctly(int flags, bool isMulti) { var message = new DeleteMessage(__requestId, __databaseName, __collectionName, __query, isMulti); using (var stream = new MemoryStream()) using (var binaryWriter = new BsonBinaryWriter(stream)) { var subject = new DeleteMessageBinaryEncoder(null, binaryWriter); subject.WriteMessage(message); var bytes = stream.ToArray(); bytes[__flagsOffset].Should().Be((byte)flags); } }