Exemplo n.º 1
0
        public void Settings_Legacy_Pre_13()
        {
            //Arrange

            var ctxFactory    = new FakeHttpContextFactory("~/somesite/hello");
            var configSection = GetSection("LegacyConfig1.3.Config");

            StringExtensions.GetConfigSection = () => configSection;
            NetworkHelper.GetConfigSection    = () => configSection;

            //Act

            //set the xml file mapper folder to be the default for file processing provider at runtime
            XmlFileMapper.FileMapVirtualFolder = "~/App_Data/TEMP/ClientDependency";
            BaseCompositeFileProcessingProvider.UrlTypeDefault = CompositeUrlType.Base64QueryStrings;
            var settings = new ClientDependencySettings(configSection, ctxFactory.Context);

            //Assert

            Assert.AreEqual(typeof(LoaderControlProvider), settings.DefaultFileRegistrationProvider.GetType());
            Assert.AreEqual(123456, settings.Version);
            foreach (var i in ".js,.css,.less".Split(','))
            {
                Assert.IsTrue(settings.FileBasedDependencyExtensionList.Contains(i.ToUpper()));
            }
            Assert.AreEqual(typeof(StandardRenderer), settings.DefaultMvcRenderer.GetType());
            Assert.AreEqual(typeof(CompositeFileProcessingProvider), settings.DefaultCompositeFileProcessingProvider.GetType());
            Assert.AreEqual(1, settings.ConfigSection.CompositeFileElement.MimeTypeCompression.Count);
            Assert.AreEqual(0, settings.ConfigSection.CompositeFileElement.RogueFileCompression.Count);

            Assert.AreEqual(settings.DefaultCompositeFileProcessingProvider.CompositeFilePathAsString, "~/App_Data/TEMP/ClientDependency");
            Assert.AreEqual(settings.DefaultCompositeFileProcessingProvider.CompositeFilePathAsString, XmlFileMapper.FileMapVirtualFolder);
            Assert.AreEqual(CompositeUrlType.Base64QueryStrings, settings.DefaultCompositeFileProcessingProvider.UrlType);
        }
Exemplo n.º 2
0
        public void Settings_Min_Sections_Defined()
        {
            //Arrange

            var ctxFactory    = new FakeHttpContextFactory("~/somesite/hello");
            var configSection = GetSection("MinSections.Config");

            StringExtensions.GetConfigSection = () => configSection;
            NetworkHelper.GetConfigSection    = () => configSection;

            //Act

            var settings = new ClientDependencySettings(configSection, ctxFactory.Context);

            //Assert

            Assert.AreEqual(typeof(PlaceHolderProvider), settings.DefaultFileRegistrationProvider.GetType());
            Assert.AreEqual(11111, settings.Version);
            Assert.AreEqual(typeof(StandardRenderer), settings.DefaultMvcRenderer.GetType());
            Assert.AreEqual(typeof(CompositeFileProcessingProvider), settings.DefaultCompositeFileProcessingProvider.GetType());
            Assert.AreEqual(0, settings.ConfigSection.CompositeFileElement.MimeTypeCompression.Count);
            Assert.AreEqual(0, settings.ConfigSection.CompositeFileElement.RogueFileCompression.Count);

            Assert.AreEqual("/DependencyHandler.axd", settings.DefaultFileRegistrationProvider.GetCompositeFileHandlerPath(ctxFactory.Context));
        }
Exemplo n.º 3
0
 public static void Register(ClientDependencySettings cdSettings)
 {
     if (cdSettings.FileRegistrationProviderCollection[ProviderName] == null)
     {
         var provider = new HccPageHeaderProvider();
         provider.Initialize(ProviderName, null);
         cdSettings.FileRegistrationProviderCollection.Add(provider);
     }
 }
Exemplo n.º 4
0
        public void Settings_All_Sections_Defined()
        {
            //Arrange

            var ctxFactory    = new FakeHttpContextFactory("~/somesite/hello");
            var configSection = GetSection("AllSections.Config");

            StringExtensions.GetConfigSection = () => configSection;
            NetworkHelper.GetConfigSection    = () => configSection;

            //Act

            var settings = new ClientDependencySettings(configSection, ctxFactory.Context);

            //Assert

            Assert.AreEqual(typeof(PageHeaderProvider), settings.DefaultFileRegistrationProvider.GetType());
            Assert.AreEqual(123456, settings.Version);
            Assert.AreEqual(typeof(LazyLoadRenderer), settings.DefaultMvcRenderer.GetType());
            Assert.AreEqual(typeof(CompositeFileProcessingProvider), settings.DefaultCompositeFileProcessingProvider.GetType());
            Assert.AreEqual(2, settings.ConfigSection.CompositeFileElement.MimeTypeCompression.Count);
            Assert.AreEqual(1, settings.ConfigSection.CompositeFileElement.RogueFileCompression.Count);
        }