public void MessageToXmlTest()
        {
            XDocument document;
            var message = new MailMessage
            {
                Subject = _subject,
                Body = _body
            };

            Assert.IsTrue(message.TryParseToXml(
                _application.RootNodeName,
                _application.SubjectRegex,
                _application.BodyRegex,
                out document));

            Assert.AreEqual(@"<go>
              <pipeline><![CDATA[ProjectEuler.NET]]></pipeline>
              <label><![CDATA[21]]></label>
              <stage><![CDATA[CI]]></stage>
              <job><![CDATA[1]]></job>
              <status><![CDATA[passed]]></status>
              <detailsUrl><![CDATA[http://192.168.1.101:8153/go/pipelines/ProjectEuler.NET/21/CI/1]]></detailsUrl>
              <vcs><![CDATA[Git: git://github.com/mikeobrien/ProjectEuler.NET.git
            revision: af55e5b718374be78320019c7cc62d08ec3f51b7, modified by Mike O'Brien <[email protected]> on 2010-08-09 19:46:26.0
            Test
            modified src/ProjectEuler.UI/Web.config]]></vcs>
            </go>", document.ToString());
        }
 public void HandleMessage(MailMessage message)
 {
     XDocument document;
     if (message.TryParseToXml(_rootNodeName, _subjectRegex, _bodyRegex, out document))
     {
         message.Subject = document.Transform(_subjectStylesheetPath);
         message.Body = document.Transform(_bodyStylesheetPath);
         message.IsBodyHtml = _bodyStylesheetPath.OpenPathAsXDocument().IsHtmlStylesheet();
     }
     _emailService.Send(message);
 }