Exemplo n.º 1
0
        public void CanCreateNamedBundleWithMediaAttribute()
        {
            var mockDebugStatusReader = new StubDebugStatusReader(false);
            var mockFileWriterFactory = new StubFileWriterFactory();
            var mockFileReaderFactory = new StubFileReaderFactory();
            mockFileReaderFactory.SetContents(css);

            ICssBundle cssBundle = new CssBundle(mockDebugStatusReader,
                                                 mockFileWriterFactory,
                                                 mockFileReaderFactory);

            cssBundle
                    .Add("~/css/temp.css")
                    .WithMedia("screen")
                    .AsNamed("TestWithMedia", "~/css/output.css");

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

            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}", mockFileWriterFactory.Files[@"C:\css\output.css"]);
            Assert.AreEqual("<link rel=\"stylesheet\" type=\"text/css\" media=\"screen\" href=\"css/output.css?r=67F81278D746D60E6F711B5A29747388\" />", tag);
        }
Exemplo n.º 2
0
        public void CanCreateNamedBundleWithDebug()
        {
            var mockDebugStatusReader = new StubDebugStatusReader(true);
            var mockFileWriterFactory = new StubFileWriterFactory();
            var mockFileReaderFactory = new StubFileReaderFactory();
            mockFileReaderFactory.SetContents(css);

            ICssBundle cssBundle = new CssBundle(mockDebugStatusReader,
                                                 mockFileWriterFactory,
                                                 mockFileReaderFactory);

            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);
        }