コード例 #1
0
ファイル: PhunFileSystem.cs プロジェクト: noogen/phuncms
 /// <summary>
 /// Initializes a new instance of the <see cref="PhunFileSystem" /> class.
 /// </summary>
 /// <param name="api">The API.</param>
 /// <param name="connector">The connector.</param>
 /// <param name="context">The context.</param>
 public PhunFileSystem(IPhunApi api, IContentConnector connector)
 {
     this.connector = connector;
     this.api = api;
     this.config = Bootstrapper.Default.Config;
     this.myUtility = new ResourcePathUtility();
 }
コード例 #2
0
        public void TestGetCurrentTenantSupportMultiTenantForTwoLevelDomain()
        {
            // Arrange
            var cc = new ResourcePathUtility();
            var config = new Mock<ICmsConfiguration>();
            config.Setup(cf => cf.DomainLevel).Returns(2);
            cc.Config = config.Object;

            // Act
            var result = cc.GetTenantHost(new Uri("http://www.youbet.cha.com/blah"));

            // Assert
            Assert.AreEqual("cha.com", result);
        }
コード例 #3
0
        public void TestRenderBundlesDoesNotRenderEditorInitialize()
        {
            // Arrange
            var rvf = new ResourcePathUtility();
            rvf.Config = new PhunCmsConfigurationSection() { ResourceRoute = "BogusRoute" };
            var expected = @"<script type=""text/javascript"" src=""/BogusRoute/scripts/jquery.js""></script>";

            // Act
            var result = rvf.PhunCmsRenderBundles(includeEditorInit: false);

            // Assert
            Assert.IsTrue(result.Contains(expected));
            Assert.IsFalse(result.Contains("PhunCms.initEditor()"));
        }
コード例 #4
0
ファイル: PhunApi.cs プロジェクト: noogen/phuncms
        /// <summary>
        /// Initializes a new instance of the <see cref="PhunApi" /> class.
        /// </summary>
        /// <param name="httpContext">The HTTP context.</param>
        /// <param name="connector">The connector.</param>
        public PhunApi(HttpContextBase httpContext, IContentConnector connector)
        {
            this.utility = new ResourcePathUtility();
            this.connector = connector;
            this.host = this.utility.GetTenantHost(httpContext.Request.Url);
            this.request = new PhunRequest(httpContext);
            this.response = new PhunResponse(httpContext);
            this.phunFileSystem = new PhunFileSystem(this, connector);
            this.phunPath = new PhunPath();

            this.user = httpContext.User;
            this.cache = new PhunCache(httpContext);
            this.trace = new Trace();
            this.templateCache = new TemplateCache(this, httpContext);
        }
コード例 #5
0
 /// <summary>
 /// Initializes a new instance of the <see cref="TemplateHandler"/> class.
 /// </summary>
 public TemplateHandler()
 {
     this.Utility = new ResourcePathUtility();
 }
コード例 #6
0
        public void TestRenderBundlesWithNoParametersReturnValidPath()
        {
            // Arrange
            var rvf = new ResourcePathUtility();
            rvf.Config = new PhunCmsConfigurationSection() { ResourceRoute = "BogusRoute" };
            var expected = @"<script type=""text/javascript"" src=""/BogusRoute/scripts/jquery.js""></script>";

            // Act
            var result = rvf.PhunCmsRenderBundles();

            // Assert
            Assert.IsTrue(result.Contains(expected));
            Assert.IsTrue(result.Contains("PhunCms.initEditor()"));
        }