示例#1
0
        public void TestNullLogger()
        {
            LogDispatcher.LoggerFactory = null;
            var testee = new MyTestComponent();

            testee.DoSomeLogging();
        }
示例#2
0
        public void TestStreamFile()
        {
            MemoryStream memoryStream = new MemoryStream();

            LogDispatcher.LoggerFactory = new StreamLoggerFactory(memoryStream);
            MyTestComponent test = new MyTestComponent();

            test.DoSomeLogging();
            // Open the file and check what is inside
            byte[] fsContent = new byte[memoryStream.Length];
            memoryStream.Seek(0, SeekOrigin.Begin);
            memoryStream.Read(fsContent, 0, fsContent.Length);
            var fsText = Encoding.UTF8.GetString(fsContent, 0, fsContent.Length);

            Assert.StartsWith("An informative message", fsText);
            Assert.EndsWith("With exception context System.Exception: Something is not supported\r\n", fsText);
        }
示例#3
0
        public void TestStreamFile()
        {
            MyTestComponent test = new MyTestComponent();

            test.DoSomeLogging();
            // now close the logger
            LogDispatcher.LoggerFactory = null;
            // Open the file and check what is inside
            var fs = new FileStream(logFilePath, FileMode.Open, FileAccess.ReadWrite);

            byte[] fsContent = new byte[fs.Length];
            fs.Read(fsContent, 0, fsContent.Length);
            fs.Dispose();
            var fsText = Encoding.UTF8.GetString(fsContent, 0, fsContent.Length);

            Assert.StartsWith("An informative message", fsText);
            Assert.EndsWith("With exception context System.Exception: Something is not supported", fsText);
        }
示例#4
0
        public void TestMethodSerialDebug()
        {
            MyTestComponent test = new MyTestComponent();

            test.DoSomeLogging();
        }
示例#5
0
        public void TestDebugTest()
        {
            MyTestComponent test = new MyTestComponent();

            test.DoSomeLogging();
        }