public void SerializesMessageCorrectly()
        {
            const string message = "Foo and bar";

            var msg = CreateMinimalSyslogMessage(Facility.UserLevelMessages, Severity.Error, "MyApp", message);

            string serializedMsg = sut.Serialize(msg);

            Assert.Equal(serializedMsg, message);
        }
        public static string Serialize(this SyslogLocalMessageSerializer serializer, SyslogMessage message)
        {
            using (var stream = new MemoryStream())
            {
                serializer.Serialize(message, stream);
                stream.Flush();
                stream.Position = 0;

                using (var reader = new StreamReader(stream, Encoding.UTF8))
                    return(reader.ReadLine());
            }
        }