コード例 #1
0
        public void VerifyOutputWhenLoggingAnError()
        {
            var list = new List<string>();
            var factory = new ListLoggerFactory(list);
            var logger = factory.GetCurrentClassLogger();
            
            logger.Error(new OmgWtfException("omgwtf!!!"), "Unhandled system exception");

            Console.WriteLine(@"Logger got the following line(s):

{0}

", string.Join(Environment.NewLine, list));

            var loggedLine = list.Single();
            loggedLine.ShouldContain("ERROR: Unhandled system exception");
            loggedLine.ShouldContain(typeof(OmgWtfException).Name);
        }
コード例 #2
0
        public void VerifyOutputWhenLoggingAnError()
        {
            var list    = new List <string>();
            var factory = new ListLoggerFactory(list);
            var logger  = factory.GetCurrentClassLogger();

            logger.Error(new OmgWtfException("omgwtf!!!"), "Unhandled system exception");

            Console.WriteLine(@"Logger got the following line(s):

{0}

", string.Join(Environment.NewLine, list));

            var loggedLine = list.Single();

            loggedLine.ShouldContain("ERROR: Unhandled system exception");
            loggedLine.ShouldContain(typeof(OmgWtfException).Name);
        }