Example #1
0
        public void FallbackWriter_Write_RethrowsOnSecondaryError()
        {
            var primaryWriter   = new MockLogWriterWithError();
            var secondaryWriter = new MockLogWriterWithError();

            var writer = new FallbackWriter(primaryWriter, secondaryWriter);

            var logEvent = new LogEvent()
            {
                EventName = "Test log message"
            };

            writer.Write(logEvent);
        }
Example #2
0
        public void FallbackWriter_Write_FallsbackToSecondaryWriter()
        {
            var primaryWriter   = new MockLogWriterWithError();
            var secondaryList   = new List <LogEvent>();
            var secondaryWriter = new ListLogWriter(secondaryList, 10);

            var writer = new FallbackWriter(primaryWriter, secondaryWriter);

            var logEvent = new LogEvent()
            {
                EventName = "Test log message"
            };

            writer.Write(logEvent);

            Assert.AreEqual(1, secondaryList.Count);
            Assert.AreEqual("Test log message", secondaryList[0].EventName);
        }