예제 #1
0
        public void CanCreateNamedBundleWithDebug()
        {
            ICssBundle cssBundle = cssBundleFactory
                                   .WithDebuggingEnabled(true)
                                   .WithContents(css)
                                   .Create();

            cssBundle
            .Add("~/css/temp1.css")
            .Add("~/css/temp2.css")
            .AsNamed("TestWithDebug", "~/css/output.css");

            string tag = cssBundle.RenderNamed("TestWithDebug");

            Assert.AreEqual("<link rel=\"stylesheet\" type=\"text/css\" href=\"css/temp1.css\" /><link rel=\"stylesheet\" type=\"text/css\" href=\"css/temp2.css\" />", tag);
        }
예제 #2
0
        public void CanCreateNamedBundle()
        {
            ICssBundle cssBundle = cssBundleFactory
                                   .WithHasher(hasher)
                                   .WithDebuggingEnabled(false)
                                   .WithContents(css)
                                   .Create();

            cssBundle
            .Add("~/css/temp.css")
            .AsNamed("Test", "~/css/output.css");

            string tag = cssBundle.RenderNamed("Test");

            Assert.AreEqual("li{margin-bottom:.1em;margin-left:0;margin-top:.1em}th{font-weight:normal;vertical-align:bottom}.FloatRight{float:right}.FloatLeft{float:left}", cssBundleFactory.FileWriterFactory.Files[@"C:\css\output.css"]);
            Assert.AreEqual("<link rel=\"stylesheet\" type=\"text/css\" href=\"css/output.css?r=67F81278D746D60E6F711B5A29747388\" />", tag);
        }
예제 #3
0
        public void CanCreateNamedBundleWithForceRelease()
        {
            ICssBundle cssBundle = cssBundleFactory
                                   .WithHasher(hasher)
                                   .WithDebuggingEnabled(true)
                                   .WithContents(css)
                                   .Create();

            cssBundle
            .Add("~/css/temp.css")
            .ForceRelease()
            .AsNamed("TestForce", "~/css/named_withforce.css");

            string tag = cssBundle.RenderNamed("TestForce");

            Assert.AreEqual("li{margin-bottom:.1em;margin-left:0;margin-top:.1em}th{font-weight:normal;vertical-align:bottom}.FloatRight{float:right}.FloatLeft{float:left}", cssBundleFactory.FileWriterFactory.Files[TestUtilities.PreparePathRelativeToWorkingDirectory(@"C:\css\named_withforce.css")]);
            Assert.AreEqual("<link rel=\"stylesheet\" type=\"text/css\" href=\"css/named_withforce.css?r=67F81278D746D60E6F711B5A29747388\" />", tag);
        }
예제 #4
0
 public static MvcHtmlString RenderNamedMvc(this ICssBundle cssBundle, string name)
 {
     return(MvcHtmlString.Create(cssBundle.RenderNamed(name)));
 }
예제 #5
0
 public static IHtmlString RenderNamedMvc(this ICssBundle cssBundle, string name)
 {
     return(new MvcHtmlString(cssBundle.RenderNamed(name)));
 }