예제 #1
0
        public void CreateReturnsSameInstance()
        {
            var logger1 = NullLogger.GetInstance();
            var logger2 = NullLogger.GetInstance();

            logger2.Equals(logger1).ShouldBeTrue();
        }
예제 #2
0
 /// <summary>
 /// Creates a new Router object
 /// </summary>
 public Router()
 {
     RegisteredRoutes = new List <IRoute>();
     Logger           = NullLogger.GetInstance();
     Scanner          = new RouteScanner();
     Scope            = string.Empty;
 }
예제 #3
0
파일: Router.cs 프로젝트: devkhan/Grapevine
 /// <summary>
 /// Returns a new Router object
 /// </summary>
 public Router()
 {
     _routingTable = new List <IRoute>();
     Logger        = NullLogger.GetInstance();
     Scanner       = new RouteScanner();
     Scope         = string.Empty;
 }
예제 #4
0
 /// <summary>
 /// Creates a new Router object
 /// </summary>
 public Router()
 {
     RegisteredRoutes = new List <IRoute>();
     RouteCache       = new ConcurrentDictionary <string, IList <IRoute> >();
     Logger           = NullLogger.GetInstance();
     Scanner          = new RouteScanner();
     Scope            = string.Empty;
 }
예제 #5
0
 public ServerSettings()
 {
     PublicFolders = new List <IPublicFolder>();
     Host          = "localhost";
     Logger        = NullLogger.GetInstance();
     Port          = "1234";
     Router        = new Router();
     UseHttps      = false;
 }
예제 #6
0
 public ServerSettings()
 {
     Connections  = 50;
     Host         = "localhost";
     Logger       = NullLogger.GetInstance();
     Port         = "1234";
     PublicFolder = new PublicFolder();
     Router       = new Router();
     UseHttps     = false;
 }
예제 #7
0
        public ServerSettings()
        {
            PublicFolders = new List <IPublicFolder>();
            Connections   = 50;
            Host          = "localhost";
            Logger        = NullLogger.GetInstance();
            Port          = "1234";
            Router        = new Router();
            UseHttps      = false;

            DependencyResolver = new ContainerBuilder();
        }
예제 #8
0
        internal RouteScanner()
        {
            Logger = NullLogger.GetInstance();

            _excludedNamespaces = new List <string>();
            _includedNamespaces = new List <string>();

            _excludedTypes = new List <Type>();
            _includedTypes = new List <Type>();

            _excludedAssemblies = new List <Assembly>();
            _includedAssemblies = new List <Assembly>();
        }
예제 #9
0
        public void CreateInitializesLoggerOnFirstAccess()
        {
            var field = typeof(NullLogger).GetField("_logger", BindingFlags.Static | BindingFlags.NonPublic);

            field.SetValue(null, null);
            field.GetValue(null).ShouldBeNull();

            var logger1 = NullLogger.GetInstance();

            field.GetValue(null).ShouldNotBeNull();

            var logger2 = NullLogger.GetInstance();

            logger2.Equals(logger1).ShouldBeTrue();
        }
예제 #10
0
        internal RouteScanner()
        {
            Logger = NullLogger.GetInstance();

            _excludedNamespaces = new List <string>()
            {
#if NETSTANDARD
                "Microsoft.VisualStudio.TestPlatform.ObjectModel"
#endif
            };
            _includedNamespaces = new List <string>();

            _excludedTypes = new List <Type>();
            _includedTypes = new List <Type>();

            _excludedAssemblies = new List <Assembly>();
            _includedAssemblies = new List <Assembly>();
        }
예제 #11
0
            public void PropogatesToScanner()
            {
                var scanner = new RouteScanner();

                scanner.Logger.ShouldBeOfType <NullLogger>();

                var router = new Router {
                    Scanner = scanner
                };

                router.Logger.ShouldBeOfType <NullLogger>();

                router.Logger = new InMemoryLogger();

                router.Logger.ShouldBeOfType <InMemoryLogger>();
                scanner.Logger.ShouldBeOfType <InMemoryLogger>();

                router.Scanner = null;
                Should.NotThrow(() => router.Logger = NullLogger.GetInstance());
            }
예제 #12
0
        public void AllMethodsDoNothing()
        {
            const string msg = "Log Message";
            var          obj = new object();
            var          ex  = new Exception();

            var logger = NullLogger.GetInstance();

            logger.Log(new LogEvent());

            logger.Debug(obj);
            logger.Debug(msg);
            logger.Debug(msg, ex);

            logger.Error(obj);
            logger.Error(msg);
            logger.Error(msg, ex);

            logger.Fatal(obj);
            logger.Fatal(msg);
            logger.Fatal(msg, ex);

            logger.Info(obj);
            logger.Info(msg);
            logger.Info(msg, ex);

            logger.Warn(obj);
            logger.Warn(msg);
            logger.Warn(msg, ex);

            logger.Trace(obj);
            logger.Trace(msg);
            logger.Trace(msg, ex);

            logger.Level.ShouldBe(LogLevel.Trace);
        }