public void Same_type_receives_same_logger_instance()
        {
            var repository = new ContextLoggerRepository("foo");
            var logger     = repository.Get <A>();

            Assert.AreSame(logger, repository.Get <A>(), "logger instances were not the same");
        }
        public void Loggers_from_same_repository_share_context()
        {
            var repository = new ContextLoggerRepository("foo");
            var loggerA    = repository.Get <A>() as ContextLogger;
            var loggerB    = repository.Get <B>() as ContextLogger;

            Assert.AreEqual(loggerA.Context, loggerB.Context, "loggers had different contexts from same repository");
        }
 public void Loggers_for_same_class_but_different_context_share_same_base() {
     var r1 = new ContextLoggerRepository("foo");
     var r2 = new ContextLoggerRepository("bar");
     var logger1 = r1.Get<A>() as ContextLogger;
     var logger2 = r2.Get<A>() as ContextLogger;
     Assert.AreSame(logger1.Logger, logger2.Logger);
 }
 public void Loggers_for_same_class_but_different_context_are_not_the_same() {
     var r1 = new ContextLoggerRepository("foo");
     var r2 = new ContextLoggerRepository("bar");
     var logger1 = r1.Get<A>() as ContextLogger;
     var logger2 = r2.Get<A>() as ContextLogger;
     Assert.AreNotSame(logger1, logger2);
 }
 public void Can_get_logger() {
     var repository = new ContextLoggerRepository("foo");
     var logger = repository.Get<A>();
     Assert.IsNotNull(logger,"could not get a logger from repository");
     var contextLogger = logger as ContextLogger;
     Assert.IsNotNull(contextLogger,"logger could not be cast to context logger");
 }
        public void Loggers_for_same_class_but_different_context_share_same_base()
        {
            var r1      = new ContextLoggerRepository("foo");
            var r2      = new ContextLoggerRepository("bar");
            var logger1 = r1.Get <A>() as ContextLogger;
            var logger2 = r2.Get <A>() as ContextLogger;

            Assert.AreSame(logger1.Logger, logger2.Logger);
        }
        public void Loggers_for_same_class_but_different_context_are_not_the_same()
        {
            var r1      = new ContextLoggerRepository("foo");
            var r2      = new ContextLoggerRepository("bar");
            var logger1 = r1.Get <A>() as ContextLogger;
            var logger2 = r2.Get <A>() as ContextLogger;

            Assert.AreNotSame(logger1, logger2);
        }
        public void Can_get_logger()
        {
            var repository = new ContextLoggerRepository("foo");
            var logger     = repository.Get <A>();

            Assert.IsNotNull(logger, "could not get a logger from repository");
            var contextLogger = logger as ContextLogger;

            Assert.IsNotNull(contextLogger, "logger could not be cast to context logger");
        }
 public void Loggers_from_same_repository_share_context() {
     var repository = new ContextLoggerRepository("foo");
     var loggerA = repository.Get<A>() as ContextLogger;
     var loggerB = repository.Get<B>() as ContextLogger;
     Assert.AreEqual(loggerA.Context,loggerB.Context,"loggers had different contexts from same repository");
 }
Пример #10
0
 public void Same_type_receives_same_logger_instance() {
     var repository = new ContextLoggerRepository("foo");
     var logger = repository.Get<A>();
     Assert.AreSame(logger, repository.Get<A>(),"logger instances were not the same");
 }