示例#1
0
        public void WillLogErrorMethod()
        {
            var backend = new FakeLoggingBackend();

            LoggingManager.Configure(backend);
            var obj = new LoggingObject();

            Assert.Throws <DivideByZeroException>(() => obj.DivisionError());

            Assert.True(backend.logs.Any(x => x.Item4 != null && x.Item4.GetType() == typeof(DivideByZeroException)));
        }
示例#2
0
        public void WillLogMethod()
        {
            var backend = new FakeLoggingBackend();

            LoggingManager.Configure(backend);
            var obj    = new LoggingObject();
            var result = obj.AddMethod(10, 10);

            Assert.Equal(20, result);

            Assert.True(backend.logs.Any(x => x.Item1.Method.Name == "AddMethod"));
        }