Ejemplo n.º 1
0
 private ISimpleLogFactory CreateFactory()
 {
     if (_testHelper == null)
     {
         _testHelper = SimpleLogTestHelper.Create(fooCategory, fooLevel, defaultLevel);
     }
     return(_testHelper.CreateFactory());
 }
Ejemplo n.º 2
0
        public static SimpleLogTestHelper Create(string fooCategory, SimpleLogLevel fooLevel, SimpleLogLevel defaultLevel)
        {
            var simpleLogTestHelper = new SimpleLogTestHelper();

            simpleLogTestHelper.FooCategory  = fooCategory;
            simpleLogTestHelper.FooLevel     = fooLevel;
            simpleLogTestHelper.DefaultLevel = defaultLevel;
            return(simpleLogTestHelper);
        }
Ejemplo n.º 3
0
        public void Log_SimpleEx_Should_Ok()
        {
            var testHelper       = SimpleLogTestHelper.Create("foo", SimpleLogLevel.Information, SimpleLogLevel.Information);
            var simpleLogFactory = testHelper.CreateFactory();
            var logActions       = simpleLogFactory.LogActions;

            var mockLogger = new MockLogger();

            logActions["MockLog"] = new LogMessageAction("MockLog", true, args => mockLogger.Log(args));

            var simpleLog = simpleLogFactory.Create("Foo");

            simpleLog.LogInfo("ABC");
            mockLogger.Invoked.ShouldTrue();
        }