Ejemplo n.º 1
0
        public void MergedCssDoesntContainStyleWithMediaAndTitle()
        {
            UnitTestHelper.SetHttpContextWithBlogRequest("localhost", "blog", string.Empty);
            var pathProvider = new Mock<VirtualPathProvider>();
            pathProvider.SetupSkins();
            var skinEngine = new SkinEngine(pathProvider.Object);

            var renderer = new StyleSheetElementCollectionRenderer(skinEngine);
            var mergedStyles = (List<StyleDefinition>)renderer.GetStylesToBeMerged("Piyo");

            Assert.IsFalse(mergedStyles.Contains(new StyleDefinition("/Skins/Piyo/piyo-fixed.css", "screen")),
                           "Skin Piyo should not have the fixed screen css in the merged CSS");
        }
Ejemplo n.º 2
0
        public void MergedCssDoesntContainDefaultIfExcluded()
        {
            UnitTestHelper.SetHttpContextWithBlogRequest("localhost", "blog", string.Empty);
            var pathProvider = new Mock<VirtualPathProvider>();
            pathProvider.SetupSkins();
            var skinEngine = new SkinEngine(pathProvider.Object);

            var renderer = new StyleSheetElementCollectionRenderer(skinEngine);
            var mergedStyles = (List<StyleDefinition>)renderer.GetStylesToBeMerged("WPSkin");

            Assert.IsFalse(mergedStyles.Contains(new StyleDefinition("/Skins/WPSkin/style.css")),
                           "Skin WPSkin should not have the default style.css");
        }
Ejemplo n.º 3
0
        public void MergedCssContainsStyleWithMedia()
        {
            UnitTestHelper.SetHttpContextWithBlogRequest("localhost", "blog", string.Empty);
            var pathProvider = new Mock<VirtualPathProvider>();
            pathProvider.SetupSkins();
            var skinEngine = new SkinEngine(pathProvider.Object);

            var renderer = new StyleSheetElementCollectionRenderer(skinEngine);
            var mergedStyles = (List<StyleDefinition>)renderer.GetStylesToBeMerged("Piyo");

            Assert.IsTrue(mergedStyles.Contains(new StyleDefinition("/Skins/Piyo/print.css", "print")),
                          "Skin Piyo should have the print css in the merged css");
        }
Ejemplo n.º 4
0
        public void MergedCssIsCorrect(string skinKey, int expectedStyles)
        {
            UnitTestHelper.SetHttpContextWithBlogRequest("localhost", "blog", string.Empty);
            MockRepository mocks = new MockRepository();

            VirtualPathProvider pathProvider = GetTemplatesPathProviderMock(mocks);
            mocks.ReplayAll();

            SkinTemplateCollection templates = new SkinTemplateCollection(pathProvider);
            StyleSheetElementCollectionRenderer renderer = new StyleSheetElementCollectionRenderer(templates);
            int mergedStyles = renderer.GetStylesToBeMerged(skinKey).Count;

            Assert.AreEqual(expectedStyles, mergedStyles, String.Format("Skin {0} should have {1} merged styles but found {2}", skinKey, expectedStyles, mergedStyles));
        }
Ejemplo n.º 5
0
        public void MergedCssDoesntContainStyleWithMediaAndTitle()
        {
            UnitTestHelper.SetHttpContextWithBlogRequest("localhost", "blog", string.Empty);
            MockRepository mocks = new MockRepository();

            VirtualPathProvider pathProvider = GetTemplatesPathProviderMock(mocks);
            mocks.ReplayAll();

            SkinTemplateCollection templates = new SkinTemplateCollection(pathProvider);
            StyleSheetElementCollectionRenderer renderer = new StyleSheetElementCollectionRenderer(templates);
            List<StyleDefinition> mergedStyles = (List<StyleDefinition>)renderer.GetStylesToBeMerged("Piyo");

            Assert.IsFalse(mergedStyles.Contains(new StyleDefinition("/Skins/Piyo/piyo-fixed.css", "screen")), "Skin Piyo should not have the fixed screen css in the merged CSS");
        }
Ejemplo n.º 6
0
        public void MergedCssDoesntContainDefaultIfExcluded()
        {
            UnitTestHelper.SetHttpContextWithBlogRequest("localhost", "blog", string.Empty);
            MockRepository mocks = new MockRepository();

            VirtualPathProvider pathProvider = GetTemplatesPathProviderMock(mocks);
            mocks.ReplayAll();

            SkinTemplateCollection templates = new SkinTemplateCollection(pathProvider);
            StyleSheetElementCollectionRenderer renderer = new StyleSheetElementCollectionRenderer(templates);
            List<StyleDefinition> mergedStyles = (List<StyleDefinition>)renderer.GetStylesToBeMerged("WPSkin");

            Assert.IsFalse(mergedStyles.Contains(new StyleDefinition("/Skins/WPSkin/style.css")), "Skin WPSkin should not have the default style.css");
        }