Ejemplo n.º 1
0
        public void Ctor_UrlIsNotEmpty_UrlPropertyIsSet()
        {
            // arrange, act
            var sut = new ThemeInclude("/url");

            // assert
            Assert.That(sut.Url, Is.EqualTo("/url"));
        }
Ejemplo n.º 2
0
        public void Ctor_UrlIsEmptyOrNull_SetsUrlPropertyToEmpty(string url)
        {
            // arrange, act
            var sut = new ThemeInclude(null);

            // assert
            Assert.That(sut.Url, Is.Empty);
        }
Ejemplo n.º 3
0
        public void Ctor_WhenCalled_SetsStylesheetsProperty()
        {
            // arrange
            var stylesheet1 = new ThemeInclude("file1.css");
            var stylesheet2 = new ThemeInclude("file2.css");

            // act
            var sut = new ThemeFiles(new[] { stylesheet1, stylesheet2 }, Enumerable.Empty <ThemeScriptInclude>());

            // assert
            var stylesheets = sut.Stylesheets;

            Assert.That(stylesheets, Contains.Item(stylesheet1));
            Assert.That(stylesheets, Contains.Item(stylesheet2));
        }
Ejemplo n.º 4
0
        protected virtual void AddThemeIncludeSpeedy(ThemeInclude themeInclude, AssetLinks result, IThemesProvider themesProvider)
        {
            Item item = themeInclude.Theme;

            if (item == null && !themeInclude.ThemeId.IsNull)
            {
                item = ContentRepository.GetItem(themeInclude.ThemeId);
            }
            if (item != null)
            {
                Log.Debug($"Starting optimized files generation process for {item.Name} with following configuration {_configuration}");
                IList <Item> allThemes = ServiceLocator.ServiceProvider.GetService <IThemingContext>().GetAllThemes(item);
                GetLinksSpeedy(allThemes.FilterBaseThemes(), _configuration.ScriptsMode, _configuration.StylesMode, result);
                GetLinksSpeedy(themesProvider.GetThemes(item, allThemes), _configuration.ScriptsMode, _configuration.StylesMode, result);
            }
        }