Implementation of ILoggerFacade that logs into a TextWriter.
Inheritance: ILoggerFacade, IDisposable
Beispiel #1
0
        public void ShouldDisposeWriterOnDispose()
        {
            MockWriter writer = new MockWriter();
            IDisposable logger = new TextLogger(writer);

            Assert.IsFalse(writer.DisposeCalled);
            logger.Dispose();
            Assert.IsTrue(writer.DisposeCalled);
        }
Beispiel #2
0
        public void ShouldWriteToTextWriter()
        {
            TextWriter writer = new StringWriter();
            ILoggerFacade logger = new TextLogger(writer);

            logger.Log("Test", Category.Debug, Priority.Low);
            StringAssert.Contains(writer.ToString(), "Test");
            StringAssert.Contains(writer.ToString(), "DEBUG");
            StringAssert.Contains(writer.ToString(), "Low");
        }
Beispiel #3
0
 public void NullTextWriterThrows()
 {
     ILoggerFacade logger = new TextLogger(null);
 }
 public void NullTextWriterThrows()
 {
     Assert.ThrowsException<ArgumentNullException>(() => { ILoggerFacade logger = new TextLogger(null); });
 }