private void Log(LogLevel logLevel, object message, Exception exception) { if (ShouldSendToLog(logLevel, LogLevel)) { _plugin.Log(logLevel, ThreadContext.GetCurrent().Identifier, message, exception); } }
public void SetUp() { _mockery = new MockRepository(); _instancePlugin = _mockery.DynamicMock <ILogger>(); ThreadContext.Create("Easy.Tests"); ThreadContext.GetCurrent().SetInstance(new Logger(_instancePlugin)); }
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>())); }
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]; }
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(); }
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" }; }
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" }; }
public void TearDown() { ThreadContext.GetCurrent().SetInstance <Logger>(null); }
internal Logger(ILogger plugin) { _plugin = plugin; LogLevel = LoggerConfig.LoadRuntimeConfiguration(ThreadContext.GetCurrent().ConfigurationName); }
internal override object Invoke(ProxyMethodCall methodCall) { ThreadContext.GetCurrent().Initialize(); return(Next(methodCall)); }