Esempio n. 1
0
        public void XmlLayoutFormatMessage_ReturnCorrectString()
        {
            var xmllayout = new XmlLayout();

            var timeMessageOccured = DateTime.Now;
            var messageType = ReportLevel.Fatal;
            var message = "blqblqbq";
            string messageThatShouldReturn = "<log>" + Environment.NewLine + "   <date>"
                                                + timeMessageOccured.ToShortDateString() + " "
                                                + timeMessageOccured.ToLongTimeString() + "</date>" + Environment.NewLine
                                                + "<level>" + messageType + "</level>" + Environment.NewLine
                                                + "   <message>" + message + "</message>" + Environment.NewLine + "</log>";

            string test = xmllayout.FormatMessage(DateTime.Now, ReportLevel.Critical, "blqblqbq");
            if (messageThatShouldReturn.Equals(test))
            {
                throw new InvalidOperationException("The two strings are not the same!");
            }
        }
Esempio n. 2
0
 public void PassNullMessageToXmlLayoutFormatMessage_ThrowException()
 {
     var xmllayout = new XmlLayout();
     xmllayout.FormatMessage(DateTime.Now, ReportLevel.Critical, null);
 }