当前位置: 首页>>代码示例>>C#>>正文


C# Mock.SetupSkins方法代码示例

本文整理汇总了C#中Mock.SetupSkins方法的典型用法代码示例。如果您正苦于以下问题:C# Mock.SetupSkins方法的具体用法?C# Mock.SetupSkins怎么用?C# Mock.SetupSkins使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Mock的用法示例。


在下文中一共展示了Mock.SetupSkins方法的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: ScriptElementCollectionRendererRendersJSHandlerScript

        public void ScriptElementCollectionRendererRendersJSHandlerScript()
        {
            UnitTestHelper.SetHttpContextWithBlogRequest("localhost", "blog", string.Empty);

            var pathProvider = new Mock<VirtualPathProvider>();
            pathProvider.SetupSkins();
            var skinEngine = new SkinEngine(pathProvider.Object);

            var renderer = new ScriptElementCollectionRenderer(skinEngine);
            string scriptElements = renderer.RenderScriptElementCollection("RedBook-Blue.css");

            string script =
                @"<script type=""text/javascript"" src=""/Skins/RedBook/js.axd?name=RedBook-Blue.css""></script>";
            Assert.IsTrue(scriptElements.Contains(script), "Rendered the script improperly.");
        }
开发者ID:ChrisPelatari,项目名称:SubText,代码行数:15,代码来源:SkinScriptsTests.cs

示例2: CanGetExcludeDefaultStyleAttribute

        public void CanGetExcludeDefaultStyleAttribute()
        {
            var pathProvider = new Mock<VirtualPathProvider>();
            pathProvider.SetupSkins();
            var skinEngine = new SkinEngine(pathProvider.Object);
            IDictionary<string, SkinTemplate> templates = skinEngine.GetSkinTemplates(false /* mobile */);

            SkinTemplate templateWithTrueExcludedDefault = templates["RedBook-Blue.css"];
            Assert.IsTrue(templateWithTrueExcludedDefault.ExcludeDefaultStyle, "ExcludeDefaultStyle should be True.");

            SkinTemplate templateWithFalseExcludedDefault = templates["Gradient"];
            Assert.IsFalse(templateWithFalseExcludedDefault.ExcludeDefaultStyle, "ExcludeDefaultStyle should be false.");

            SkinTemplate templateWithoutExcludedDefault = templates["Piyo"];
            Assert.IsFalse(templateWithoutExcludedDefault.ExcludeDefaultStyle, "ExcludeDefaultStyle should be false.");
        }
开发者ID:ChrisPelatari,项目名称:SubText,代码行数:16,代码来源:SkinStylesTests.cs

示例3: CanGetScriptMergeModeAttribute

        public void CanGetScriptMergeModeAttribute()
        {
            var pathProvider = new Mock<VirtualPathProvider>();
            pathProvider.SetupSkins();
            var skinEngine = new SkinEngine(pathProvider.Object);
            IDictionary<string, SkinTemplate> templates = skinEngine.GetSkinTemplates(false /* mobile */);

            SkinTemplate templateWithMergeScriptMergeMode = templates["Piyo"];
            Assert.IsTrue(templateWithMergeScriptMergeMode.MergeScripts, "ScriptMergeMode should be Merge.");

            SkinTemplate templateWithDontMergeScriptMergeMode = templates["Semagogy"];
            Assert.IsFalse(templateWithDontMergeScriptMergeMode.MergeScripts, "ScriptMergeMode should be DontMerge.");

            SkinTemplate templateWithoutScriptMergeMode = templates["RedBook-Green.css"];
            Assert.IsFalse(templateWithoutScriptMergeMode.MergeScripts, "ScriptMergeMode should be None.");
        }
开发者ID:ChrisPelatari,项目名称:SubText,代码行数:16,代码来源:SkinScriptsTests.cs

示例4: CallsToCssHandlerAreNotRepeated

        public void CallsToCssHandlerAreNotRepeated(string skinKey, string exptectedElements)
        {
            UnitTestHelper.SetHttpContextWithBlogRequest("localhost", "blog", string.Empty);
            var pathProvider = new Mock<VirtualPathProvider>();
            pathProvider.SetupSkins();
            var skinEngine = new SkinEngine(pathProvider.Object);

            var renderer = new StyleSheetElementCollectionRenderer(skinEngine);
            string styleElements = renderer.RenderStyleElementCollection(skinKey);
            IDictionary<string, SkinTemplate> templates = skinEngine.GetSkinTemplates(false);
            SkinTemplate template = templates[skinKey];

            string mergedCss = @"<link type=""text/css"" rel=""stylesheet"" href=""/Skins/" + template.TemplateFolder +
                               "/css.axd?name=" + skinKey + @""" />";
            styleElements = styleElements.Replace(mergedCss, string.Empty);
            Assert.IsTrue(styleElements.Trim('\r', '\n').Equals(exptectedElements), "Not the expected stylesheet links");
        }
开发者ID:ChrisPelatari,项目名称:SubText,代码行数:17,代码来源:SkinStylesTests.cs

示例5: ScriptElementCollectionRendererRendersScriptElements

        public void ScriptElementCollectionRendererRendersScriptElements()
        {
            UnitTestHelper.SetHttpContextWithBlogRequest("localhost", "blog", string.Empty);

            var pathProvider = new Mock<VirtualPathProvider>();
            pathProvider.SetupSkins();
            var skinEngine = new SkinEngine(pathProvider.Object);
            var renderer = new ScriptElementCollectionRenderer(skinEngine);
            string scriptElements = renderer.RenderScriptElementCollection("RedBook-Green.css");

            string script = @"<script type=""text/javascript"" src=""/Skins/RedBook/blah.js""></script>";
            Assert.IsTrue(scriptElements.Contains(script), "Rendered the script improperly.");

            scriptElements = renderer.RenderScriptElementCollection("Nature-Leafy.css");
            script = @"<script type=""text/javascript"" src=""/scripts/XFNHighlighter.js""></script>";
            Assert.IsTrue(scriptElements.Contains(script), "Rendered the script improperly. We got: " + scriptElements);
        }
开发者ID:ChrisPelatari,项目名称:SubText,代码行数:17,代码来源:SkinScriptsTests.cs

示例6: CanGetMergeModeAttribute

        public void CanGetMergeModeAttribute()
        {
            var pathProvider = new Mock<VirtualPathProvider>();
            pathProvider.SetupSkins();
            var skinEngine = new SkinEngine(pathProvider.Object);
            IDictionary<string, SkinTemplate> templates = skinEngine.GetSkinTemplates(false /* mobile */);

            SkinTemplate templateWithMergedFirstMergeMode = templates["Semagogy"];
            Assert.AreEqual(StyleMergeMode.MergedFirst, templateWithMergedFirstMergeMode.StyleMergeMode,
                            "MergeMode should be MergedFirst.");

            SkinTemplate templateWithMergedAfterMergeMode = templates["RedBook-Green.css"];
            Assert.AreEqual(StyleMergeMode.MergedAfter, templateWithMergedAfterMergeMode.StyleMergeMode,
                            "MergeMode should be MergedAfter.");

            SkinTemplate templateWithNoneMergeMode = templates["RedBook-Red.css"];
            Assert.AreEqual(StyleMergeMode.None, templateWithNoneMergeMode.StyleMergeMode, "MergeMode should be None.");

            Assert.AreNotEqual(StyleMergeMode.MergedAfter, templateWithNoneMergeMode.StyleMergeMode,
                               "MergeMode should not be MergedAfter.");

            SkinTemplate templateWithoutMergeMode = templates["RedBook-Blue.css"];
            Assert.AreEqual(StyleMergeMode.None, templateWithoutMergeMode.StyleMergeMode, "MergeMode should be None.");
        }
开发者ID:ChrisPelatari,项目名称:SubText,代码行数:24,代码来源:SkinStylesTests.cs

示例7: StyleSheetElementCollectionRenderer_WithNoneMergeModeAndSecondaryStyle_RendersPlainCssLinkElements

        public void StyleSheetElementCollectionRenderer_WithNoneMergeModeAndSecondaryStyle_RendersPlainCssLinkElements(
            string subFolder, string applicationPath, string expectedPrintCssPath, string expectedDefaultCssPath,
            string expectedSecondaryCssPath)
        {
            UnitTestHelper.SetHttpContextWithBlogRequest("localhost", subFolder, applicationPath);
            var pathProvider = new Mock<VirtualPathProvider>();
            pathProvider.SetupSkins();
            var skinEngine = new SkinEngine(pathProvider.Object);

            var renderer = new StyleSheetElementCollectionRenderer(skinEngine);
            string styleElements = renderer.RenderStyleElementCollection("Lightz-light.css");

            string printCss =
                string.Format(@"<link media=""print"" type=""text/css"" rel=""stylesheet"" href=""{0}"" />",
                              expectedPrintCssPath);
            Assert.IsTrue(styleElements.Contains(printCss, StringComparison.OrdinalIgnoreCase),
                          "Expected the printcss to be there.");

            string defaultCss = string.Format(@"<link type=""text/css"" rel=""stylesheet"" href=""{0}"" />",
                                              expectedDefaultCssPath);
            Assert.IsTrue(styleElements.Contains(defaultCss, StringComparison.OrdinalIgnoreCase),
                          "Expected the default css to be there.");

            string secondaryCss = string.Format(@"<link type=""text/css"" rel=""stylesheet"" href=""{0}"" />",
                                                expectedSecondaryCssPath);
            Assert.IsTrue(styleElements.Contains(secondaryCss, StringComparison.OrdinalIgnoreCase),
                          "Expected the secondary css to be there.");
        }
开发者ID:ChrisPelatari,项目名称:SubText,代码行数:28,代码来源:SkinStylesTests.cs

示例8: StyleSheetElementCollectionRendererRendersMergedCssLinkElements

        public void StyleSheetElementCollectionRendererRendersMergedCssLinkElements(string subFolder,
            string applicationPath,
            string expectedPrintCssPath)
        {
            UnitTestHelper.SetHttpContextWithBlogRequest("localhost", subFolder, applicationPath);
            var pathProvider = new Mock<VirtualPathProvider>();
            pathProvider.SetupSkins();
            var skinEngine = new SkinEngine(pathProvider.Object);

            var renderer = new StyleSheetElementCollectionRenderer(skinEngine);
            string styleElements = renderer.RenderStyleElementCollection("Piyo");

            string printCss =
                string.Format(
                    @"<link media=""screen"" type=""text/css"" rel=""stylesheet"" title=""fixed"" href=""{0}"" />",
                    expectedPrintCssPath);
            Assert.IsTrue(styleElements.Contains(printCss, StringComparison.OrdinalIgnoreCase),
                          "Expected the fixed screen css to be there.");
        }
开发者ID:ChrisPelatari,项目名称:SubText,代码行数:19,代码来源:SkinStylesTests.cs

示例9: StyleSheetElementCollectionRendererRendersLinkElementsInRightOrder

        public void StyleSheetElementCollectionRendererRendersLinkElementsInRightOrder(string skinKey,
            bool expectedFirst)
        {
            UnitTestHelper.SetHttpContextWithBlogRequest("localhost", "blog", string.Empty);
            var pathProvider = new Mock<VirtualPathProvider>();
            pathProvider.SetupSkins();
            var skinEngine = new SkinEngine(pathProvider.Object);

            var renderer = new StyleSheetElementCollectionRenderer(skinEngine);

            string styleElements = renderer.RenderStyleElementCollection(skinKey);
            SkinTemplate template = skinEngine.GetSkinTemplates(false)[skinKey];

            styleElements = styleElements.Trim('\r', '\n');
            string mergedCss = @"<link type=""text/css"" rel=""stylesheet"" href=""/Skins/" + template.TemplateFolder +
                               "/css.axd?name=" + skinKey + @""" />";
            if(expectedFirst)
            {
                Assert.IsTrue(styleElements.StartsWith(mergedCss, StringComparison.OrdinalIgnoreCase),
                              "Merged CSS is not in first position");
            }
            else
            {
                Assert.IsTrue(styleElements.EndsWith(mergedCss, StringComparison.OrdinalIgnoreCase),
                              "Merged CSS is not in last position");
            }
        }
开发者ID:ChrisPelatari,项目名称:SubText,代码行数:27,代码来源:SkinStylesTests.cs

示例10: MergedCssDoesntContainStyleWithMediaAndTitle

        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");
        }
开发者ID:ChrisPelatari,项目名称:SubText,代码行数:13,代码来源:SkinStylesTests.cs

示例11: MergedCssDoesntContainDefaultIfExcluded

        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");
        }
开发者ID:ChrisPelatari,项目名称:SubText,代码行数:13,代码来源:SkinStylesTests.cs

示例12: MergedCssContainsStyleWithMedia

        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");
        }
开发者ID:ChrisPelatari,项目名称:SubText,代码行数:13,代码来源:SkinStylesTests.cs

示例13: ScriptsWithNoneScriptMergeModeAreNotMerged

        public void ScriptsWithNoneScriptMergeModeAreNotMerged()
        {
            var pathProvider = new Mock<VirtualPathProvider>();
            pathProvider.SetupSkins();
            var skinEngine = new SkinEngine(pathProvider.Object);
            IDictionary<string, SkinTemplate> templates = skinEngine.GetSkinTemplates(false /* mobile */);
            SkinTemplate template = templates["Semagogy"];
            bool canBeMerged = ScriptElementCollectionRenderer.CanScriptsBeMerged(template);

            Assert.IsFalse(canBeMerged, "Skins with ScriptMergeMode=\"DontMerge\" should not be mergeable.");
        }
开发者ID:ChrisPelatari,项目名称:SubText,代码行数:11,代码来源:SkinScriptsTests.cs

示例14: ScriptsWithRemoteSrcAreNotMerged

        public void ScriptsWithRemoteSrcAreNotMerged()
        {
            var pathProvider = new Mock<VirtualPathProvider>();
            pathProvider.SetupSkins();
            var skinEngine = new SkinEngine(pathProvider.Object);

            IDictionary<string, SkinTemplate> templates = skinEngine.GetSkinTemplates(false /* mobile */);
            SkinTemplate template = templates["RedBook-Red.css"];
            bool canBeMerged = ScriptElementCollectionRenderer.CanScriptsBeMerged(template);

            Assert.IsFalse(canBeMerged, "Skins with remote scripts should not be mergeable.");
        }
开发者ID:ChrisPelatari,项目名称:SubText,代码行数:12,代码来源:SkinScriptsTests.cs


注:本文中的Mock.SetupSkins方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。