コード例 #1
0
 private void Log(LogLevel logLevel, object message, Exception exception)
 {
     if (ShouldSendToLog(logLevel, LogLevel))
     {
         _plugin.Log(logLevel, ThreadContext.GetCurrent().Identifier, message, exception);
     }
 }
コード例 #2
0
ファイル: LoggerTest.cs プロジェクト: alex-mtx/EasyFramework
        public void SetUp()
        {
            _mockery        = new MockRepository();
            _instancePlugin = _mockery.DynamicMock <ILogger>();

            ThreadContext.Create("Easy.Tests");
            ThreadContext.GetCurrent().SetInstance(new Logger(_instancePlugin));
        }
コード例 #3
0
        public void Setup()
        {
            _mockery        = new MockRepository();
            _instancePlugin = _mockery.DynamicMock <IContainer>();

            ThreadContext.Create("Easy.Tests");
            ThreadContext.GetCurrent().SetInstance(new Easy.Instances.IoC.Container(_instancePlugin));
            ThreadContext.GetCurrent().SetInstance(new Easy.Instances.Log.Logger(MockRepository.GenerateStub <ILogger>()));
        }
コード例 #4
0
        public void Setup()
        {
            _mockery        = new MockRepository();
            _instancePlugin = _mockery.DynamicMock <ITranslator>();

            ThreadContext.Create("EasyArchitecture.Tests");
            ThreadContext.GetCurrent().SetInstance(new Translator(_instancePlugin));
            ThreadContext.GetCurrent().SetInstance(new EasyArchitecture.Instances.Log.Logger(MockRepository.GenerateStub <ILogger>()));
        }
コード例 #5
0
        public void SetUp()
        {
            _mockery     = new MockRepository();
            _cachePlugin = _mockery.DynamicMock <ICache>();

            _key = Guid.NewGuid().ToString();

            ThreadContext.Create("Easy.Tests");
            ThreadContext.GetCurrent().SetInstance(new Easy.Instances.Log.Logger(MockRepository.GenerateStub <ILogger>()));
        }
コード例 #6
0
        public void SetUp()
        {
            _mockery        = new MockRepository();
            _instancePlugin = _mockery.DynamicMock <IStorage>();

            ThreadContext.Create("EasyArchitecture.Tests");
            ThreadContext.GetCurrent().SetInstance(new Storer(_instancePlugin));
            ThreadContext.GetCurrent().SetInstance(new EasyArchitecture.Instances.Log.Logger(MockRepository.GenerateStub <ILogger>()));

            _buffer = new byte[10];
        }
コード例 #7
0
ファイル: LoggerTest.cs プロジェクト: alex-mtx/EasyFramework
        public void Should_log()
        {
            const string originalMessage = "mensagem de teste";
            var          message         = string.Format("   [Message]: {0}", originalMessage);
            var          identifier      = ThreadContext.GetCurrent().Identifier;

            Expect.Call(() => _instancePlugin.Log(LogLevel.Debug, identifier, message, null)).Repeat.Once();
            _mockery.ReplayAll();

            Mechanisms.Log.Logger.Message(originalMessage).Debug();

            _mockery.VerifyAll();
        }
コード例 #8
0
        public void SetUp()
        {
            _mockery        = new MockRepository();
            _instancePlugin = _mockery.DynamicMock <IPersistence>();

            ThreadContext.Create("Easy.Tests");
            ThreadContext.GetCurrent().SetInstance(new Easy.Instances.Persistence.Persistence(_instancePlugin));
            ThreadContext.GetCurrent().SetInstance(new Easy.Instances.Log.Logger(MockRepository.GenerateStub <ILogger>()));

            _dog = new Dog {
                Age = 15, Name = "Old Dog"
            };
        }
コード例 #9
0
        public void SetUp()
        {
            _mockery        = new MockRepository();
            _instancePlugin = _mockery.DynamicMock <IValidator>();

            ThreadContext.Create("Easy.Tests");
            ThreadContext.GetCurrent().SetInstance(new Easy.Instances.Validation.Validator(_instancePlugin));
            ThreadContext.GetCurrent().SetInstance(new Easy.Instances.Log.Logger(MockRepository.GenerateStub <ILogger>()));

            _oldDog = new Dog {
                Age = 15, Name = "Old Dog"
            };
            _youngDog = new Dog {
                Age = 5, Name = "Young Dog"
            };
        }
コード例 #10
0
ファイル: LoggerTest.cs プロジェクト: alex-mtx/EasyFramework
 public void TearDown()
 {
     ThreadContext.GetCurrent().SetInstance <Logger>(null);
 }
コード例 #11
0
 internal Logger(ILogger plugin)
 {
     _plugin  = plugin;
     LogLevel = LoggerConfig.LoadRuntimeConfiguration(ThreadContext.GetCurrent().ConfigurationName);
 }
コード例 #12
0
 internal override object Invoke(ProxyMethodCall methodCall)
 {
     ThreadContext.GetCurrent().Initialize();
     return(Next(methodCall));
 }