Beispiel #1
0
        public void GivenBundleWithMedia_WhenRender_ThenHtmlLinkWithMediaAttributeReturned()
        {
            var bundle = new StylesheetBundle("~/tests")
            {
                Media = "MEDIA"
            };
            var urlGenerator = new Mock <IUrlGenerator>();

            urlGenerator.Setup(g => g.CreateBundleUrl(bundle))
            .Returns("URL");

            var renderer = new StylesheetHtmlRenderer(urlGenerator.Object);
            var html     = renderer.Render(bundle);

            html.ShouldEqual("<link href=\"URL\" type=\"text/css\" rel=\"stylesheet\" media=\"MEDIA\"/>");
        }
        public void GivenBundle_WhenRender_ThenHtmlLinkReturned()
        {
            var bundle       = new StylesheetBundle("~/tests");
            var urlGenerator = new Mock <IUrlGenerator>();

            urlGenerator.Setup(g => g.CreateBundleUrl(bundle))
            .Returns("URL")
            .Verifiable();

            var renderer = new StylesheetHtmlRenderer(urlGenerator.Object);
            var html     = renderer.Render(bundle);

            html.ShouldEqual("<link href=\"URL\" type=\"text/css\" rel=\"stylesheet\"/>");

            urlGenerator.VerifyAll();
        }
Beispiel #3
0
        public void GivenStylesheetBundleWithNotIECondition_WhenRender_ThenHtmlConditionalCommentWrapsLinkButLeavesStylesheetVisibleToAllBrowsers()
        {
            var bundle = new StylesheetBundle("~/test")
            {
                Condition = "(gt IE 9)| !IE"
            };
            var urlGenerator = new Mock <IUrlGenerator>();

            urlGenerator.Setup(g => g.CreateBundleUrl(bundle)).Returns("URL");

            var renderer = new StylesheetHtmlRenderer(urlGenerator.Object);
            var html     = renderer.Render(bundle);

            html.ShouldEqual(
                "<!--[if " + bundle.Condition + "]><!-->" + Environment.NewLine +
                "<link href=\"URL\" type=\"text/css\" rel=\"stylesheet\"/>" + Environment.NewLine +
                "<!-- <![endif]-->"
                );
        }
Beispiel #4
0
        public void GivenStylesheetBundleWithCondition_WhenRender_ThenHtmlConditionalCommentWrapsLink()
        {
            var bundle = new StylesheetBundle("~/test")
            {
                Condition = "CONDITION"
            };
            var urlGenerator = new Mock <IUrlGenerator>();

            urlGenerator.Setup(g => g.CreateBundleUrl(bundle)).Returns("URL");

            var renderer = new StylesheetHtmlRenderer(urlGenerator.Object);
            var html     = renderer.Render(bundle);

            html.ShouldEqual(
                "<!--[if CONDITION]>" + Environment.NewLine +
                "<link href=\"URL\" type=\"text/css\" rel=\"stylesheet\"/>" + Environment.NewLine +
                "<![endif]-->"
                );
        }