示例#1
0
        public StylesheetPipeline_Process_TestBase()
        {
            settings = new CassetteSettings();
            bundle   = new StylesheetBundle("~");
            asset1   = new Mock <IAsset>();
            asset2   = new Mock <IAsset>();
            bundle.Assets.Add(asset1.Object);
            bundle.Assets.Add(asset2.Object);

            asset1.SetupGet(a => a.Path)
            .Returns("~/asset1.css");
            asset1.Setup(a => a.OpenStream())
            .Returns(() => "/* @reference \"asset2.css\"; */".AsStream());
            asset2.SetupGet(a => a.Path)
            .Returns("~/asset2.css");
            asset2.Setup(a => a.OpenStream())
            .Returns(() => "p { color: White; }".AsStream());
            asset1.SetupGet(a => a.References)
            .Returns(new[] { new AssetReference(asset1.Object.Path, "~/asset2.css", -1, AssetReferenceType.SameBundle) });

            minifier     = new MicrosoftStylesheetMinifier();
            urlGenerator = new Mock <IUrlGenerator>();
            container    = new TinyIoCContainer();
            container.Register(minifier);
            container.Register(urlGenerator.Object);
            container.Register(settings);
        }
 public void TransformMinifiesCss()
 {
     var minifier = new MicrosoftStylesheetMinifier();
     var getResult = minifier.Transform(() => "p { color: White; }".AsStream(), Mock.Of<IAsset>());
     using (var result = getResult())
     {
         result.ReadToEnd().ShouldEqual("p{color:#fff}");
     }
 }
示例#3
0
        public void TransformMinifiesCss()
        {
            var minifier  = new MicrosoftStylesheetMinifier();
            var getResult = minifier.Transform(() => "p { color: White; }".AsStream(), new StubAsset());

            using (var result = getResult())
            {
                result.ReadToEnd().ShouldEqual("p{color:#fff}");
            }
        }
示例#4
0
 public StylesheetPipeline()
 {
     StylesheetMinifier = new MicrosoftStylesheetMinifier();
 }
示例#5
0
 public StylesheetPipeline()
 {
     StylesheetMinifier = new MicrosoftStylesheetMinifier();
     CompileLess        = true;
 }