コード例 #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);
        }
コード例 #2
0
        public void TestThatStartThreadLogicalActivitySetsTheMessageId()
        {
            var testId = "LogicalThreadActivity";
            var writer = new StreamWriter(new MemoryStream());
            var converter = new MessageIdConverter();

            var log = Substitute.For<ILog>();
            using (log.StartMessage(testId))
            {
                converter.Format(writer, new LoggingEvent(new LoggingEventData()));
                writer.Flush();

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

                Assert.AreEqual(testId, result);
            }
        }