Esempio n. 1
0
 private void Log(LogLevel logLevel, object message, Exception exception)
 {
     if (ShouldSendToLog(logLevel, LogLevel))
     {
         _plugin.Log(logLevel, ThreadContext.GetCurrent().Identifier, message, exception);
     }
 }
Esempio n. 2
0
        public void SetUp()
        {
            _mockery        = new MockRepository();
            _instancePlugin = _mockery.DynamicMock <ILogger>();

            ThreadContext.Create("Easy.Tests");
            ThreadContext.GetCurrent().SetInstance(new Logger(_instancePlugin));
        }
Esempio n. 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>()));
        }
        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>()));
        }
        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>()));
        }
Esempio n. 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];
        }
Esempio n. 7
0
        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();
        }
Esempio n. 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"
            };
        }
Esempio n. 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"
            };
        }
Esempio n. 10
0
 public void TearDown()
 {
     ThreadContext.GetCurrent().SetInstance <Logger>(null);
 }
Esempio n. 11
0
 internal Logger(ILogger plugin)
 {
     _plugin  = plugin;
     LogLevel = LoggerConfig.LoadRuntimeConfiguration(ThreadContext.GetCurrent().ConfigurationName);
 }
Esempio n. 12
0
 internal override object Invoke(ProxyMethodCall methodCall)
 {
     ThreadContext.GetCurrent().Initialize();
     return(Next(methodCall));
 }