Beispiel #1
0
        public void ConvertTestNoStackData()
        {
            var writer    = new StreamWriter(new MemoryStream());
            var converter = new MessageIdConverter();

            var log = Substitute.For <ILog>();

            converter.Format(writer, new LoggingEvent(new LoggingEventData()));
            writer.Flush();

            var result = TestUtilities.GetStringFromStream(writer.BaseStream);

            Assert.AreEqual("-", result);
        }
        public void TestThatStartThreadLogicalActivitySetsTheMessageId()
        {
            var testId    = "LogicalThreadActivity";
            var writer    = new StreamWriter(new MemoryStream());
            var converter = new MessageIdConverter();

            var log = Substitute.For <ILog>();

            using (log.StartThreadLogicialActivity("NDC", testId))
            {
                converter.Format(writer, new LoggingEvent(new LoggingEventData()));
                writer.Flush();

                var result = TestUtilities.GetStringFromStream(writer.BaseStream);

                Assert.AreEqual(testId, result);
            }
        }