示例#1
0
        public UIRouterConfig GetFormatConfig()
        {
            UIRouterConfig result = new UIRouterConfig();

            //format ui router
            if (null != this.UIRouter && this.UIRouter.Count > 0)
            {
                foreach (var router in this.UIRouter)
                {
                    var uirouter = RouterHelper.FormatStaticUIRouter(router.Key);
                    var filePath = router.Value;
                    if (!Path.IsPathRooted(filePath))
                    {
                        filePath = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, filePath);
                    }

                    result.UIRouter.Add(uirouter, filePath);
                }
            }

            //format log router
            if (!string.IsNullOrWhiteSpace(this.LogRouter))
            {
                result.LogRouter = RouterHelper.FormatWebApiRouter(this.LogRouter);
            }

            //format log handler
            if (null != this.LogHandler)
            {
                result.LogHandler = this.LogHandler;
            }

            return(result);
        }
示例#2
0
        public void TestFormatStaticUIRouter()
        {
            Assert.IsTrue(string.Equals(RouterHelper.FormatStaticUIRouter(string.Empty), ""), "Format Empty Error");
            Assert.IsTrue(string.Equals(RouterHelper.FormatStaticUIRouter(""), ""), "Format Empty String Error");
            Assert.IsTrue(string.Equals(RouterHelper.FormatStaticUIRouter("/"), ""), "Format / Error");

            Assert.IsTrue(string.Equals(RouterHelper.FormatStaticUIRouter("ui/ui1"), "/ui/ui1"), "Format ui Error");
            Assert.IsTrue(string.Equals(RouterHelper.FormatStaticUIRouter("/ui/ui1"), "/ui/ui1"), "Format /ui Error");
        }