public void Write_WritesMessageToStorage()
        {
            var message = new Message("This is my message");
            var mockStorage = Substitute.For<IPersistentStorage>();

            var messageWriter = new MessageWriter(mockStorage);

            messageWriter.Write(message);

            mockStorage.Received(1).Write(Arg.Any<byte[]>());
        }
 private static byte[] SerializeMessage(Message message)
 {
     return Encoding.UTF8.GetBytes(message.Contents);
 }
        public void Write(Message message)
        {
            var serializedMessage = SerializeMessage(message);

            _storage.Write(serializedMessage);
        }