Пример #1
0
        public void SimpleLayoutFormatMessage_ReturnCorrectString()
        {
            var simpleLayout = new SimpleLayout();

            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 = simpleLayout.FormatMessage(DateTime.Now, ReportLevel.Critical, "blqblqbq");
            if (messageThatShouldReturn.Equals(test))
            {
                throw new InvalidOperationException("The two strings are not the same!");
            }
        }
Пример #2
0
 public void PassNullMessageToSimpleLayoutFormatMessage_ThrowException()
 {
     var simpleLayout = new SimpleLayout();
     simpleLayout.FormatMessage(DateTime.Now, ReportLevel.Critical, null);
 }