Example #1
0
		public void TestBase64EventLogging()
		{
			TextWriter writer = new StringWriter();
			XmlLayout layout = new XmlLayout();
			LoggingEventData evt = CreateBaseEvent();

			layout.Base64EncodeMessage = true;
			layout.Format(writer, new LoggingEvent(evt));

			string expected = CreateEventNode("VGVzdCBtZXNzYWdl");

			Assert.AreEqual(expected, writer.ToString());
		}
Example #2
0
		public void TestIllegalCharacterMasking()
		{
			TextWriter writer = new StringWriter();
			XmlLayout layout = new XmlLayout();
			LoggingEventData evt = CreateBaseEvent();

			evt.Message = "This is a masked char->\uFFFF";

			layout.Format(writer, new LoggingEvent(evt));

			string expected = CreateEventNode("This is a masked char->?");

			Assert.AreEqual(expected, writer.ToString());
		}
Example #3
0
		public void TestCDATAEscaping3()
		{
			TextWriter writer = new StringWriter();
			XmlLayout layout = new XmlLayout();
			LoggingEventData evt = CreateBaseEvent();

			//The &'s trigger the use of a cdata block
			evt.Message = "]]>&&&&&&&Escape the begining";

			layout.Format(writer, new LoggingEvent(evt));

			string expected = CreateEventNode("<![CDATA[]]>]]<![CDATA[>&&&&&&&Escape the begining]]>");

			Assert.AreEqual(expected, writer.ToString());
		}
Example #4
0
		public void TestBasicEventLogging()
		{
			TextWriter writer = new StringWriter();
			XmlLayout layout = new XmlLayout();
			LoggingEventData evt = CreateBaseEvent();

			layout.Format(writer, new LoggingEvent(evt));

			string expected = CreateEventNode("Test message");

			Assert.AreEqual(expected, writer.ToString());
		}