public void WritesFormattedMessageToTextWriter(LogSeverity severity, string message, bool includeException, string expectedText)
        {
            StringWriter writer = new StringWriter();
            writer.NewLine = "\n";
            var logger = new SeverityPrefixLogger(new TextLogger(writer));

            logger.Log(severity, message, includeException ? new Exception("Foo") : null);

            Assert.AreEqual(expectedText, writer.ToString());
        }
        public void LoggerAndParserAreSymmetrical(LogSeverity severity)
        {
            const string message = "Message";

            StringWriter writer = new StringWriter();
            writer.NewLine = "\n";
            var logger = new SeverityPrefixLogger(new TextLogger(writer));
            logger.Log(severity, message);

            var parser = new SeverityPrefixParser();

            LogSeverity parsedSeverity;
            string parsedMessage;
            bool hasSeverity = parser.ParseLine(writer.ToString().Trim(), out parsedSeverity, out parsedMessage);

            Assert.AreEqual(severity, parsedSeverity);
            Assert.AreEqual(message, parsedMessage);
            Assert.IsTrue(hasSeverity);
        }